Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python start process in background and get pid

from subprocess import Popen

# Subprocess Command
cmd = "python3 another_process.py"
p = Popen(cmd.split())
print("Process ID:", p.pid)

# Check the status of process
# poll() method returns 'None' if the process is running else returns the exit code
print(p.poll())
Source by docs.python.org #
 
PREVIOUS NEXT
Tagged: #python #start #process #background #pid
ADD COMMENT
Topic
Name
5+9 =