title: PyQt5 - call a function outside of the main Widget
body: <p>I have two scripts files which are <em>test_qt.py</em> and <em>test.py</em>. I want to call a function when I press the push button. But this function it is not inside the Widget file(test_qt). I can call the function easily if it is inside the Widget file but if i try to call it out of the test_qt, I get this error "<em>AttributeError: 'Ui_Form' object has no attribute 'test_something'</em>". I have checked many examples but I havent solved yet. I want to call <em>test_something()</em> function. I dont know where is the mistake. I defined <em>print_something()</em> function to call the <em>test_something()</em></p>
  
  <pre><code>#----test_qt.py----
  from PyQt5 import QtCore, QtGui, QtWidgets
  from test import*
  
  class Ui_Form(object):
      def setupUi(self, Form):
          Form.setObjectName("Form")
          Form.resize(400, 300)
          self.pushButton = QtWidgets.QPushButton(Form)
          self.pushButton.setGeometry(QtCore.QRect(150, 100, 93, 28))
          self.pushButton.setObjectName("pushButton")
          self.pushButton.clicked.connect(self.print_something)
  
          self.retranslateUi(Form)
          QtCore.QMetaObject.connectSlotsByName(Form)
  
      def retranslateUi(self, Form):
          _translate = QtCore.QCoreApplication.translate
          Form.setWindowTitle(_translate("Form", "Form"))
          self.pushButton.setText(_translate("Form", "PushButton"))
  
      def print_something(self):
          #strong textprint("click")
          self.test_something()
  
  if __name__ == "__main__":
      import sys
      app = QtWidgets.QApplication(sys.argv)
      Form = QtWidgets.QWidget()
      ui = Ui_Form()
      ui.setupUi(Form)
      Form.show()
      sys.exit(app.exec_())
  ---------------------------
  #---- test.py -------------
  def test_something():
      print("clicked")
  ---------------------------
  </code></pre>