title: PyQt Code Splitting - Design Vs Functionality
body: <p>Am struggling to comprehend how to split code in (Py)Qt.  The aim is to have the design &amp; navigation tabs in QMainWindow, each tab triggering code in other files.  So far it only launches with the ActionClass in the same document / putting in an external document causes 'app not defined' when clicking the tab.  The below works without errors, but is clunky.  </p>
  
  <pre><code>class Main(QMainWindow):
      def __init__(self):
          QMainWindow.__init__(self)
  
          self.u = Ui_MainWindow()
          self.u.setupUi(self)
  
          self.u.tabs.currentChanged.connect(self.TabsChanged)
  
      def TabsChanged(self, i):
          if i == self.u.tabs.indexOf(self.u.tabFirst): ActionClass.__init__
  
  
  class ActionClass(Main):
      def __init__(self):
          app.u.lineEdit.setText("test")
  
  app = Main()
  app.show()
  sys.exit(app.exec_())
  </code></pre>
  
  <p>The examples I keep seeing have all code in one document.  Is there another way to do this e.g. where the ActionClass is in another file/writing u.lineEdit.setText instead of app.u.lineEdit.setText.  It seems inheritance &amp; an instance of Main can't be accessed from the ActionClasses doc, so I can't see how they would communicate back to the Main?  </p>
  
  <p>Much appreciated        </p>