title: Run external program concurrently in Python
body: <p>I'm wondering how to call an external program in such a way that allows the user to continue to interact with my program's UI (built using tkinter, if it matters) while the Python program is running. The program waits for the user to select files to copy, so they should still be able to select and copy files while the external program is running. The external program is Adobe Flash Player.</p>
  
  <p>Perhaps some of the difficulty is due to the fact that I have a threaded "worker" class? It updates the progress bar while it does the copying. I would like the progress bars to update even if the Flash Player is open.</p>
  
  <ol>
  <li><p>I tried the <code>subprocess</code> module. The program runs, however it prevents the user from using the UI until the Flash Player is closed. Also, the copying still seems to occur in the background, it's just that the progress bar does not update until the Flash Player is closed.</p>
  
  <pre><code>def run_clip():
      flash_filepath = "C:\\path\\to\\file.exe"
  
      # halts UI until flash player is closed...
      subprocess.call([flash_filepath])              
  </code></pre></li>
  <li><p>Next, I tried using the <code>concurrent.futures</code> module (I was using Python 3 anyway). Since I'm still using <code>subprocess</code> to call the application, it's not surprising that this code behaves exactly like the above example. </p>
  
  <pre><code>def run_clip():
      with futures.ProcessPoolExecutor() as executor:
      flash_filepath = "C:\\path\\to\\file.exe"
      executor.submit(subprocess.call(animate_filepath))
  </code></pre></li>
  </ol>
  
  <p>Does the problem lie in using <code>subprocess</code>? If so, is there a better way to call the external program? Thanks in advance.</p>