title: Allow multiple Python GUIs to run the same exe simultaneously
body: <p>A Python GUI that I develop executes an exe file in the same directory. I need to allow the user to open multiple instances of the GUI. This results in the same exe being called simultaneously and raises the following error: <code>the process can not access the file because it is being used by another process</code>. I use a dedicated thread in the python GUI to run the exe. </p>
  
  <p>How can I allow the multiple GUIs to run the same exe simultaneously? </p>
  
  <p>I would appreciate code examples.</p>
  
  <p>Following is the thread. The run includes the execution of the exe. This exe was made using fortran.</p>
  
  <pre><code>class LineariseThread(threading.Thread):
  def __init__(self, parent):
      threading.Thread.__init__(self)
      self._parent = parent
  
  
  def run(self):
  
      self.p = subprocess.Popen([exe_linearise], shell=True, stdout=subprocess.PIPE)
  
      print threading.current_thread()
  
      print "Subprocess started"
      while True:
          line = self.p.stdout.readline()
          if not line:
              break      
          print line.strip()
          self._parent.status.SetStatusText(line.strip())
          # Publisher().sendMessage(('change_statusbar'), line.strip())
          sys.stdout.flush()
  
      if not self.p.poll():
          print " process done"
          evt_show = LineariseEvent(tgssr_show, -1)
          wx.PostEvent(self._parent, evt_show)
  
  
  def killtree(self, pid):  
      print pid
      parent = psutil.Process(pid)
      print "in killtree sub: "
      for child in parent.get_children(recursive=True):
          child.kill()
      parent.kill()
  
  
  
  def abort(self):
      if self.isAlive():
          print "Linearisation thread is alive"
  
          # kill the respective subprocesses
          if not self.p.poll():
              # stop them all
              self.killtree(int(self.p.pid))
  
  
          self._Thread__stop()
          print str(self.getName()) + " could not be terminated"
  
          self._parent.LineariseThread_killed=True
  </code></pre>