I think you want the subprocess module, and the subprocess.Popen class specifically. It lets you spawn a non-blocking child process and check its pid/return code (if it's finished running)/etc.
edit: See the documentation here: http://docs.python.org/library/subprocess.html
edit edit: In the simplest case, you would use it like this:
PHP Code:
import subprocess
import time
pobj = subprocess.Popen("ls")
while pobj.poll() is None:
print "ls is still running"
time.sleep(3)
print "ls return code is %s" % pobj.poll()
Bookmarks