title: How to launch and run external script in background?
body: <p>I tried these two methods:</p>
  
  <pre><code>os.system("python test.py")
  
  subprocess.Popen("python test.py", shell=True)
  </code></pre>
  
  <p>Both approaches need to wait until test.py finishes which blocks main process. I know "nohup" can do the job. Is there a Python way to launch test.py or any other shell scripts and leave it running in background?</p>
  
  <p>Suppose test.py is like this:</p>
  
  <pre><code>for i in range(0, 1000000):
      print i
  </code></pre>
  
  <p>Both os.system() or subprocess.Popen() will block main program until 1000000 lines of output displayed. What I want is let test.py runs silently and display main program output only. Main program may quie while test.py is still running.</p>