title: How in Python & PyQt5 load contents of a tab from another class?
body: <p>There is a class MainWindow, which has a bar with tabs. One of the tabs create FactorsTab class, located in FactorsTabWidget.py file.</p>
  <p>at startup crashes:</p>
  <blockquote>
  <p>line 13, in <strong>init</strong> self.table =
  QtGui.QStandardItemModel(parent=self.frame_factors) AttributeError:
  'NoneType' object has no attribute 'QStandardItemModel'</p>
  <p>line 13 in file FactorsTabWidget.py: self.table = &gt; QtGui.QStandardItemModel(parent=self.frame_factors)</p>
  </blockquote>
  <p>How to generate the contents of a tab from another class?</p>
  <p><strong>file main.py</strong></p>
  <pre><code>class MainWindow(QtWidgets.QMainWindow):
      def __init__(self, parent=None):
          QtWidgets.QMainWindow.__init__(self, parent)
          factors_tab = FactorsTabWidget.FactorsTab()
          self.tabs = QtWidgets.QTabWidget()
          self.tabs.addTab(factors_tab, &quot;Factors&quot;)        
  </code></pre>
  <p><strong>file FactorsTabWidget.py</strong></p>
  <pre><code>class FactorsTab(QtWidgets.QWidget):
      def __init__(self):
          QtWidgets.QWidget.__init__(self, parent=None)
          self.frame_factors = QtWidgets.QTableView()
          self.table = QtGui.QStandardItemModel(parent=self.frame_factors)
          self.lst1 = ['Дискета', 'Бумага для принтера', 'Барабан для принтера']
          self.lst2 = [&quot;10&quot;, &quot;3&quot;, &quot;10452048&quot;]
          for row in range(0, 3):
              item1 = QtGui.QStandardItem(self.lst1[row])
              item2 = QtGui.QStandardItem(self.lst2[row])
              self.table.appendRow([item1, item2])
          self.table.setHorizontalHeaderLabels(['Factor Name', 'Кол-во'])
          self.frame_factors.setModel(self.table)
  </code></pre>