I am trying to make an app with pytq5 and mysql. However, I can't print my connexion to my database. Here is my code: This is my function that lets me connect to the database: def connect(self): print("Clicked") # connexion.open_window(self) host = self.ui.ip_input.text() user = self.ui.user_input.text() password = self.ui.pass_input.text() database = self.ui.data_input.text() try: self.connexion_mysql = mysql.connector.connect( host = host, user = user, password = password, database = database ) print(f"host = {host}, user = {user}, password = {password}, database = {database}") QtWidgets.QMessageBox.information(self, "Connected", "Now you are connected to your database") # self.open_window() except mysql.connector.Error as err: print("There is an error", err) QtWidgets.QMessageBox.warning(self, "The connexion failed", "Please check the information and Retry") print("Connected {0}".format(connexion)) This function lets me create the window: def App(): app = QtWidgets.QApplication(sys.argv) win = connexion() win.show() sys.exit(app.exec_()) App() And this is my init function: def __init__(self): super().__init__() self.ui = Ui_Form() self.ui.setupUi(self) self.ui.connect_btn.clicked.connect(self.connect) self.connexion_mysql = None Now let's describe my program. First when I launch my program this window is displayed:login window After I enter my information, all of which is correct(ip adress, user, paswword and the database). And in my terminal i go this: "Clicked". There is no error message. I tried to see what these lines return using the print function: host = self.ui.ip_input.text() user = self.ui.user_input.text() password = self.ui.pass_input.text() database = self.ui.data_input.text() I got all the information that I entered previously. Continue reading...