Search code examples
pythonchild-process

How to run another Python program without holding up original


What command in Python can be used to run another Python program?

It should not wait for the child process to terminate. Instead, it should continue on. It also does not need to remember its child processes.


Solution

  • Use subprocess:

    import subprocess
    
    #code
    prog = subprocess.Popen(['python', filename, args])
    #more code