title: PySide2 : AttributeError: 'NoneType' object has no attribute 'objectName'
body: <p>How can I fix this error:</p>
  <p>Traceback (most recent call last):</p>
  <p>File &quot;&quot;, line 32, in run_setup_turn_table</p>
  <p>AttributeError: 'NoneType' object has no attribute 'objectName'</p>
  <pre><code>from PySide2.QtCore import *
  from PySide2.QtGui import *
  from PySide2.QtWidgets import *
  import sys
  
  class mk_preview_UI(QWidget):
      def __init__(self):
          super(mk_preview_UI,self).__init__()
          
          self.UI()
          self.layout()
          self.show()
      def UI(self):
          self.setup_turnTable = QPushButton(&quot;Setup turn table&quot;)
          self.setup_turnTable.setObjectName(&quot;run_setup_btn&quot;)
          
      def layout(self):
          self.main_layout = QVBoxLayout()
          self.main_layout.addWidget(self.setup_turnTable)
          self.setLayout(self.main_layout)
  
  
  
  class run_ui:
      def __init__(self):
          self.MainWindow = mk_preview_UI()
          self.MainWindow.setup_turnTable.clicked.connect(self.run_setup_turn_table)
  
      def run_setup_turn_table(self):
          run_button = self.MainWindow.sender()
          if run_button.objectName() == &quot;run_setup_btn&quot;:
             print &quot;run_setup_btn&quot;       
          
  
  
  if __name__ == &quot;__main__&quot;:
      app = QApplication(sys.argv)
      MainWindow = run_ui()
      sys.exit(app.exec_())
  </code></pre>