title: PySide2 (Qt for Python) how to load a .ui file in a QMainWindow subclass
body: <p>I'm trying to use Qt Creator and Qt for Python to create a quick prototype for a new application. However, the code generated by the wizard doesn't make much sense to me. This is the <code>main.py</code> file generated by Qt Creator:</p>
  <pre><code># This Python file uses the following encoding: utf-8
  import sys
  import os
  
  
  from PySide2.QtWidgets import QApplication, QMainWindow
  from PySide2.QtCore import QFile
  from PySide2.QtUiTools import QUiLoader
  
  
  class MyMainWindow(QMainWindow):
      def __init__(self):
          super(MyMainWindow, self).__init__()
          self.load_ui()
  
      def load_ui(self):
          loader = QUiLoader()
          path = os.path.join(os.path.dirname(__file__), &quot;form.ui&quot;)
          ui_file = QFile(path)
          ui_file.open(QFile.ReadOnly)
          loader.load(ui_file, self)
          ui_file.close()
  
  if __name__ == &quot;__main__&quot;:
      app = QApplication([])
      widget = MyMainWindow()
      widget.show()
      sys.exit(app.exec_())
  </code></pre>
  <p>and this is a simple <code>form.ui</code>, with just a push button:</p>
  <pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
  &lt;ui version=&quot;4.0&quot;&gt;
   &lt;class&gt;MyMainWindow&lt;/class&gt;
   &lt;widget class=&quot;QMainWindow&quot; name=&quot;MyMainWindow&quot;&gt;
    &lt;property name=&quot;geometry&quot;&gt;
     &lt;rect&gt;
      &lt;x&gt;0&lt;/x&gt;
      &lt;y&gt;0&lt;/y&gt;
      &lt;width&gt;800&lt;/width&gt;
      &lt;height&gt;600&lt;/height&gt;
     &lt;/rect&gt;
    &lt;/property&gt;
    &lt;property name=&quot;windowTitle&quot;&gt;
     &lt;string&gt;MyMainWindow&lt;/string&gt;
    &lt;/property&gt;
    &lt;widget class=&quot;QWidget&quot; name=&quot;centralwidget&quot;&gt;
     &lt;layout class=&quot;QVBoxLayout&quot; name=&quot;verticalLayout&quot;&gt;
      &lt;item&gt;
       &lt;widget class=&quot;QPushButton&quot; name=&quot;pushButton&quot;&gt;
        &lt;property name=&quot;text&quot;&gt;
         &lt;string&gt;PushButton&lt;/string&gt;
        &lt;/property&gt;
       &lt;/widget&gt;
      &lt;/item&gt;
     &lt;/layout&gt;
    &lt;/widget&gt;
    &lt;widget class=&quot;QMenuBar&quot; name=&quot;menubar&quot;&gt;
     &lt;property name=&quot;geometry&quot;&gt;
      &lt;rect&gt;
       &lt;x&gt;0&lt;/x&gt;
       &lt;y&gt;0&lt;/y&gt;
       &lt;width&gt;800&lt;/width&gt;
       &lt;height&gt;22&lt;/height&gt;
      &lt;/rect&gt;
     &lt;/property&gt;
    &lt;/widget&gt;
    &lt;widget class=&quot;QStatusBar&quot; name=&quot;statusbar&quot;/&gt;
   &lt;/widget&gt;
   &lt;resources/&gt;
   &lt;connections/&gt;
  &lt;/ui&gt;
  </code></pre>
  <p>I just don't understand the purpose of the <code>load_ui</code> function inside the <code>MyMainWindow</code> class. I know that PyQt5 can load a <code>.ui</code> file during the initialization of a widget using the <code>uic</code> module. As far as I know, this is not possible with Qt for Python. Am I missing something? I'm using Qt Creator 4.13.</p>