I'm trying to open a python script from the main python program in a separate process.
For now let's just say that "main program" is a PyQt4 GUI program and "script" is the script (in a separate file) I am trying to run from my main program.
Why?
So the script keeps running after the main program is closed
So that when the script is ran my main program doesn't freeze while waiting for the script with an infinite loop to end.
I know that subprocess.Popen()
, subprocess.call()
and os.system()
can open the file via the command line, but when they open a script with an infinite loop the main program hangs and crashes.
I also know that I could use QtCore.QCoreApplication.processEvents()
to keep the main program running, but this does not work in my case.
So I figured the best solution to keep the script and the Main Program correctly running is the have separate processes.
How would I open script.py
file in a separate process or in a way that would not freeze up my program.