title: PyQt5: TypeError: 'Wrong base class of toplevel widget'
body: <p>I have created to .ui files using QtDesigner and I load them into two seperate windows as show below </p>
  
  <pre><code>class MainWindow(QMainWindow):
      def __init__(self, parent=None):
          super().__init__()
  
          # Set up the user interface from Designer.
          uic.loadUi("interface/UI/main.ui", self)
  
          # Connect up the buttons
          self.button_classes.clicked.connect(self.open_classes)
  
          self.w = []
  
      def open_classes(self):
          self.w.append(PopupWindow(self))
          self.w[-1].show()
  
  
  class PopupWindow(QMainWindow):
      def __init__(self, parent=None):
          super().__init__()
  
          # Set up the user interface from Designer.
          uic.loadUi("interface/UI/newclass.ui", self)
  </code></pre>
  
  <p>When I run the code in PyCharm in debug mode, the following error occurs, however this does not happen when the code is run normally</p>
  
  <pre><code>TypeError: ('Wrong base class of toplevel widget', (&lt;class 'controllers.GUI.PopupWindow'&gt;, 'QDialog'))
  </code></pre>