title: How to access attribute of the main window
body: <p>I am writing a program and I want for external function to access attribute of the main window.  It must be an external function, because it is provided by import method.  I have created a really small MWE to give an idea of the problem.  Here function <code>func</code> is supposed to print value of <code>MainWindow</code>'s <code>vari</code>.</p>
  
  <pre><code>class importedclass():
      def func(self):
          print(win.vari)
  
  x=importedclass()
  
  class MainWindow(QtGui.QWidget):
      def __init__(self):
          super(MainWindow, self).__init__()
          self.vari = 1
          x.func()
  
  def main():
      app = QtGui.QApplication(sys.argv)
      win = MainWindow()
      sys.exit(app.exec_())
  
  if __name__ == '__main__':
      main()
  </code></pre>
  
  <p>Just to make it clear: <code>importedclass</code> class is my fix-up class, I am not allowed to change anything in <code>MainWindow</code> class!</p>