title: Python: QT5 include ui.py in main python script
body: <p>this might be an basic question, but I didn't found a working solution yet: </p>
  
  <p>This is my first Python UI Script... I have the idea of putting the UI in one file without any functionality and putting all the actual code and algorithms into another file, but I don't know if this is good practice or not and how to make this work. </p>
  
  <p>I have created an UI with GTDesigner and converted this into <strong>MainWindowPy.py</strong> by using pyuic5. </p>
  
  <p>This gave me: </p>
  
  <pre><code>class Ui_MainWindow(object):
      def setupUi(self, MainWindow):
          [...]
      def retranslateUi(self, MainWindow):
          [...]
  
  if __name__ == "__main__":
      import sys
      app = QtWidgets.QApplication(sys.argv)
      MainWindow = QtWidgets.QMainWindow()
      ui = Ui_MainWindow()
      ui.setupUi(MainWindow)
      MainWindow.show()
      sys.exit(app.exec_())
  </code></pre>
  
  <p>Now I want to leave this MainWindowPy.py untouched, because the UI can change in the further delevopment. </p>
  
  <p>How can I <em>link</em> and run this file in my <strong>MainApplication.py</strong> script and how can I access UI-elements like buttons? </p>
  
  <p>I tried wrapping the whole UI-code in a function and then imported this as a module in MainApplication.py and called the function through this module. It worked, but that's not "untouched".   </p>
  
  <p>I know about <code>subprocess.Popen()</code>, but maybe there is a better way?</p>