How do I spawn a separate python process?
问题 I need to spawn a separate python process that runs a sub script. For example: main.py runs and prints some output to the console. It then spawns sub.py which starts a new process. Once main.py has spawned sub.py it should terminate whilst sub.py continues to run. Thank you. Edit: When I run main.py it prints 'main.py' but nothing else and sub.py doesn't launch. main.py print "main.py" import subprocess as sp process=sp.Popen('sub.py', shell=True, stdout=sp.PIPE, stderr=sp.PIPE) out, err =