I want to launch a python script from another python script. I know how to do it. But I should launch this script only if it is not running already.
code:
import os
os.system("new_script.py")
But I'm not sure how to check if this script is already running or not.
pgrep -f 'new_script.py'|| ./new_script.pyor you have to use a lockfile with the PID.