title: "Missing self as first argument in method". Why the need of self in this case?
body: <p>I'm learning how to develop some simple GUI applications with PyQt5. I'm also learning Python because of it. There are some things about classes that I don't understand.</p>
  
  <p>For example, here I have a simple GUI code:</p>
  
  <pre><code>from PyQt5 import QtWidgets, QtCore
  import sys
  
  class Ui_MainWindow:
      def setupUi(self, MainWindow):
          MainWindow.setObjectName("MainWindow")
          MainWindow.setWindowTitle("Simple GUI")
          MainWindow.resize(800,600)
  
          self.button = QtWidgets.QPushButton(MainWindow)
          self.button.setGeometry(QtCore.QRect(10, 10, 91, 91))
          self.button.setObjectName("button1")
          self.button.setText("Button")
  
          self.new_dialog = QtWidgets.QDialog()
  
          self.button.clicked.connect(lambda: New_Dialog.setupDialog(self.new_dialog, "Simple Dialog"))
  
  class New_Dialog:
      def setupDialog(window, window_name):
          window.setObjectName(window_name)
          window.setWindowTitle(window_name)
          window.resize(600,400)
  
          window.exec()
  
  app = QtWidgets.QApplication(sys.argv)
  MainWindow = QtWidgets.QMainWindow()
  ui = Ui_MainWindow()
  ui.setupUi(MainWindow)
  MainWindow.show()
  sys.exit(app.exec_())
  </code></pre>
  
  <p>The code generates a simple Main window with a button. When I press the button, a new dialog window pops up (depicted in picture).</p>
  
  <p><a href="https://i.stack.imgur.com/yzDJm.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/yzDJm.png" alt="enter image description here"></a></p>
  
  <p>This is working as I wanted to, but it produces 5 errors:</p>
  
  <ol>
  <li><p>Method should have "self" as first argument</p></li>
  <li><p>Instance of 'New_Dialog' has no 'setObjectName' member</p></li>
  <li><p>Instance of 'New_Dialog' has no 'setWindowTitle' member</p></li>
  <li><p>Instance of 'New_Dialog' has no 'resize' member</p></li>
  <li><p>Instance of 'New_Dialog' has no 'exec' member</p></li>
  </ol>
  
  <p>Analyzing the errors, I wonder: Why I have always to have a <code>self</code> as an argument in a method of a class if there is no <code>self.variable</code> inside the method?</p>
  
  <p>When I add <code>self</code> as argument it show the following error when I press the button:</p>
  
  <pre><code>self.button.clicked.connect(lambda: New_Dialog.setupDialog(self.new_dialog, "Simple Dialog"))
  TypeError: setupDialog() missing 1 required positional argument: 'window_name'
  </code></pre>
  
  <p>What I'm doing wrong?</p>