title: Run script from GUI
body: <p>I wrote a script (test.py) for Data Analysis. Now I'm doing a GUI in PyQt.
  What I want is when I press a button 'Run', the script test.py will run and show the results (plots).</p>
  
  <p>I tried <code>subprocess.call('test1.py')</code> and <code>subprocess.Popen('test1.py')</code> but it only opens the script and don't run it.
  I also tried <code>os.system</code>, doesn't work either.</p>
  
  <p>The script below is not complete (there are more buttons and functions associated but is not relevant and aren't connect to the problem described).</p>
  
  <p>I'm using Python 3.6 on Spyder and PyQt5.</p>
  
  <p>Is there any other function or module that can do what I want? </p>
  
  <pre><code>class Window(QMainWindow):
  
      def __init__(self):
          super(Window, self).__init__()
          self.setGeometry(50, 50, 500, 300)
          self.setWindowTitle("TEMP FILE")
  
          self.home()
  
      def home (self):
          btn_run = QPushButton("Run", self)
          btn_run.clicked.connect(self.execute)
  
          self.show()
  
      def execute(self):
          subprocess.Popen('test1.py', shell=True)
          subprocess.call(["python", "test1.py"])
  
  if not QtWidgets.QApplication.instance():
      app = QtWidgets.QApplication(sys.argv)
  else:
      app = QtWidgets.QApplication.instance()
  
  GUI = Window()
  app.exec_()
  </code></pre>