If handling the multiprocess interface seems too complex there is a application called 'screen' available on most linux distributions that you can call with a one-shot commandline and it will stay active. It is full-featured and easy to interact with.
it is called something like this.
#!/usr/bin/python
import subprocess
subprocess.call(["screen", "-S", "session_name", "-X", "stuff", "'command here'`echo -ne '\015'`"])
please remember to check out the man page for what each option does and all the features that are available.
I have used this in the past to run watchdog processes on remote servers.
later you can reconnect to the session by invoking screen as follows
screen -d -r -S "session_name"
When ready to disconnect from the screen process and leave it active you issue the following key-sequence at the commandline.
Ctl-a Ctl-d
also remember the command to list all available commands
Ctl-a ?
When outside of screen if you want to see all the instances available use the command
screen -l
original reference from here