title: PyQt, when button is pressed to connect to a method of different class, code never exits __init__
body: <p>I'm currently implementing a model view architecture for my PyQt GUI. Here's a simpler, but representative version of my code at the moment. </p>
  
  <pre><code>class Model(QtGui.QWidget):
      def __init__(self):
          super(Model, self).__init__()
          self.openDir = '/some/file/dir/'
      def openFile(self):
          openFileName = QtGui.QFileDialog.getOpenFileName(None, "Open File",self.openDir,"AllFiles(*.*)")
          openFile = open(openFileName, 'r')
          ...
  
  class View(QtGui.QWidget):
      def__init__(self):
      super(View, self).__init__()
      ...
      self.button = QtGui.QPushButton("Open")
      ...
      self.button.clicked.connect(Model().openFile)
  
  if __name__ == '__main__':
      app = QtGui.QApplication(sys.argv)
      mainWindow = View()
      mainWindow.show()
      sys.exit(app.exec_())
  </code></pre>
  
  <p>So when I click the "open" button, I want to call the <code>Model</code> class' <code>openFile</code> method, but when I do click it, it goes into the <code>Model.__init__</code> but it never actually goes into the <code>openFile</code> method. What do I have to fix?</p>
  
  <hr>
  
  <p>Edit1: Fixed all mistakes. </p>
  
  <hr>
  
  <p>Edit2: For those facing similar issues, here is the solution that Fred S provided and the fixed code.</p>
  
  <pre><code>class Model(QtGui.QWidget):
      def __init__(self):
          super(Model, self).__init__()
          self.openDir = '/some/file/dir/'
      def openFile(self):
          openFileName = QtGui.QFileDialog.getOpenFileName(None, "Open File",self.openDir,"AllFiles(*.*)")
          openFile = open(openFileName, 'r')
          ...
  
  class View(QtGui.QWidget):
      def__init__(self):
      super(View, self).__init__()
      ...
      self.button = QtGui.QPushButton("Open")
      ...
      self.model = Model()
      self.button.clicked.connect(self.model.openFile)
  
  if __name__ == '__main__':
      app = QtGui.QApplication(sys.argv)
      mainWindow = View()
      mainWindow.show()
      sys.exit(app.exec_())
  </code></pre>