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