title: pyqt5 "AttributeError: type object 'Window' has no attribute label" but it does?
body: <p>I am trying to create a UI for a text game.</p>
  
  <p>This works fine, however I wanted to create my own simple print function to print to the parts of the UI (in the example the QLabel) this works, if the function is in the UI file but when I move the functions to another file, I get </p>
  
  <p>"AttributeError: type object 'Window' has no attribute 'label'"</p>
  
  <p>even though my IDE says Window.label exists before running it.</p>
  
  <p>Is this some quirk or QT? or am I making a mistake?</p>
  
  <p><strong>UI.py</strong></p>
  
  <pre><code>import sys
  from PyQt5 import QtWidgets, QtGui, QtCore
  from PyQt5.QtWidgets import *
  from PyQt5.QtCore import *
  from PyQt5.QtGui import *
  
  class Window(QWidget):
  
      def __init__(self):
          super().__init__()
  
          self.show()
          import game     
  
          self.label = QLabel("Text")
          self.label.setAlignment(Qt.AlignCenter | Qt.AlignTop)        
  
          self.output = QTextEdit()
          self.output.setReadOnly(True)        
  
          grid = QGridLayout()
          grid.setSpacing(10)
          grid.addWidget(self.label,0,0,1,10)
          grid.addWidget(self.output,1,0,10,10)
  
          self.setLayout(grid)
  
          game.Game.test()    
  
  if __name__ == '__main__':
  
      app = QApplication(sys.argv)
      ex = Window()
      sys.exit(app.exec_())
  </code></pre>
  
  <p><strong>Game.py</strong></p>
  
  <pre><code>from UI import Window
  
  class Game():
  
      def print_UI(self,*Args, **Kwargs):
  
          Window.setup.output.insertPlainText(*Args, **Kwargs)
  
      def print_label(self,*Args, **Kwargs):
  
          Window.label.setText(*Args, **Kwargs) 
  
      def test():
  
          Game.print_label("HI")
  </code></pre>