I would like to launch a python program from another python program and concurrently quit the previous program.
Here what i've done:
if(self.start_button.pression==1):
os.system('python program_to_launch.py')
sys.exit()
The result is quite obvious, the program launch the 'program_to_launch.py' and wait until it finish to run.
The problem lies in the while loop, inside the just launched program. It's made to last for an indefinite amount of time.
Here's the problem; the previous program is still waiting the ending of the new program, and it will not execute the` sys.exit()
I could kill the first program using`
NOTES:
Following the method provided by this answer, i can't import the program to launch because i want to terminate the first program
import program_to_launch
So i think that it isn't a solution.
And the command exec file()
execfile('program_to_launch.py')
as suggested in the linked answer, it provide problems to import several modules in the execution of program_to_launch.py