Не работают кнопки в приложении на PyQt5

Делаю приложение для биндов. Сделал интерфейс через Qt Designer и перевёл файл .ui в .py.
Функционал хочу прописать в отдельном файле, но вызвав класс и передав кнопке тестовую функцию, в самом приложении ничего не происходит при нажатии на кнопку.

Я уверен что, как новичок, не вижу очевидной ошибки в коде. Основной файл который запускается: Function.py

Файл с интерфейсом PrInterface.py

from PyQt5 import QtCore, QtGui, QtWidgets


class Ui_MainWindow(object):
    def setupUi(self, MainWindow):
        MainWindow.setObjectName("MainWindow")
        MainWindow.resize(490, 640)
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Ignored, QtWidgets.QSizePolicy.Ignored)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(MainWindow.sizePolicy().hasHeightForWidth())
        MainWindow.setSizePolicy(sizePolicy)
        MainWindow.setMinimumSize(QtCore.QSize(490, 640))
        MainWindow.setMaximumSize(QtCore.QSize(490, 640))
        MainWindow.setStyleSheet("background-color: rgb(229, 229, 229);")
        MainWindow.setTabShape(QtWidgets.QTabWidget.Rounded)


        self.centralwidget = QtWidgets.QWidget(MainWindow)
        self.centralwidget.setObjectName("centralwidget")

        #Кнопки
        #Back
        self.back_button = QtWidgets.QPushButton(self.centralwidget)
        self.back_button.setGeometry(QtCore.QRect(10, 10, 31, 31))
        self.back_button.setText("")
        icon = QtGui.QIcon()
        icon.addPixmap(QtGui.QPixmap("Icons/back-left.svg"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.back_button.setIcon(icon)
        self.back_button.setObjectName("back_button")

        #Forward
        self.Forward_button = QtWidgets.QPushButton(self.centralwidget)
        self.Forward_button.setGeometry(QtCore.QRect(40, 10, 31, 31))
        self.Forward_button.setObjectName("Forward_button")

        #Save
        self.save_button = QtWidgets.QPushButton(self.centralwidget)
        self.save_button.setGeometry(QtCore.QRect(70, 10, 41, 41))
        self.save_button.setText("")
        icon1 = QtGui.QIcon()
        icon1.addPixmap(QtGui.QPixmap("Icons/save.svg"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.save_button.setIcon(icon1)
        self.save_button.setObjectName("save_button")

        #Cut
        self.cut_button = QtWidgets.QPushButton(self.centralwidget)
        self.cut_button.setGeometry(QtCore.QRect(110, 10, 41, 41))
        self.cut_button.setText("")
        icon2 = QtGui.QIcon()
        icon2.addPixmap(QtGui.QPixmap("Icons/cut.svg"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.cut_button.setIcon(icon2)
        self.cut_button.setObjectName("cut_button")

        #Copy
        self.Copy_button = QtWidgets.QPushButton(self.centralwidget)
        self.Copy_button.setGeometry(QtCore.QRect(150, 10, 41, 41))
        self.Copy_button.setObjectName("Copy_button")

        #Paste
        self.paste_button = QtWidgets.QPushButton(self.centralwidget)
        self.paste_button.setGeometry(QtCore.QRect(190, 10, 41, 41))
        self.paste_button.setObjectName("paste_button")

        #Change
        self.change_button = QtWidgets.QPushButton(self.centralwidget)
        self.change_button.setGeometry(QtCore.QRect(230, 10, 41, 41))
        self.change_button.setObjectName("change_button")

        #UP
        self.Up_button = QtWidgets.QPushButton(self.centralwidget)
        self.Up_button.setGeometry(QtCore.QRect(10, 530, 41, 41))
        self.Up_button.setText("")
        icon3 = QtGui.QIcon()
        icon3.addPixmap(QtGui.QPixmap("Icons/arrow-up.svg"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.Up_button.setIcon(icon3)
        self.Up_button.setObjectName("Up_button")

        #Down 
        self.down_button = QtWidgets.QPushButton(self.centralwidget)
        self.down_button.setGeometry(QtCore.QRect(10, 570, 41, 41))
        self.down_button.setText("")
        icon4 = QtGui.QIcon()
        icon4.addPixmap(QtGui.QPixmap("Icons/arrow-down.svg"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.down_button.setIcon(icon4)
        self.down_button.setObjectName("down_button")

        #Play
        self.play_button = QtWidgets.QPushButton(self.centralwidget)
        self.play_button.setGeometry(QtCore.QRect(350, 10, 41, 41))
        self.play_button.setCheckable(True) #Отвечает за то, будет кнопка вжимаемой
        self.play_button.setObjectName("play_button")

        #Stop
        self.Stop_button = QtWidgets.QPushButton(self.centralwidget)
        self.Stop_button.setGeometry(QtCore.QRect(390, 10, 41, 41))
        self.Stop_button.setObjectName("Stop_button")

        #Delete all
        self.Delete_all_button = QtWidgets.QPushButton(self.centralwidget)
        self.Delete_all_button.setGeometry(QtCore.QRect(270, 10, 41, 41))
        icon5 = QtGui.QIcon()
        icon5.addPixmap(QtGui.QPixmap("Icons/trash.svg"), QtGui.QIcon.Normal, QtGui.QIcon.Off)

        #Delete line
        self.Delete_all_button.setIcon(icon5)
        self.Delete_all_button.setObjectName("Delete_all_button")
        self.Delete_line_button = QtWidgets.QPushButton(self.centralwidget)
        self.Delete_line_button.setGeometry(QtCore.QRect(310, 10, 41, 41))
        self.Delete_line_button.setIcon(icon5)
        self.Delete_line_button.setObjectName("Delete_line_button")

        #Список где будут бинды
        self.scrollArea = QtWidgets.QScrollArea(self.centralwidget)
        self.scrollArea.setGeometry(QtCore.QRect(30, 60, 401, 341))
        self.scrollArea.setStyleSheet("background-color: rgb(255, 255, 255);")
        self.scrollArea.setWidgetResizable(False)
        self.scrollArea.setObjectName("scrollArea")
        self.scrollAreaWidgetContents = QtWidgets.QWidget()
        self.scrollAreaWidgetContents.setGeometry(QtCore.QRect(0, 0, 399, 339))
        self.scrollAreaWidgetContents.setObjectName("scrollAreaWidgetContents")
        self.scrollArea.setWidget(self.scrollAreaWidgetContents)

        #Ползунок для списка (пока что не связан ни с чем)
        self.verticalScrollBar = QtWidgets.QScrollBar(self.centralwidget)
        self.verticalScrollBar.setGeometry(QtCore.QRect(10, 60, 16, 341))
        self.verticalScrollBar.setOrientation(QtCore.Qt.Vertical)
        self.verticalScrollBar.setObjectName("verticalScrollBar")

        #Боковые кнопки
        self.Button_1 = QtWidgets.QPushButton(self.centralwidget)
        self.Button_1.setGeometry(QtCore.QRect(440, 60, 41, 41))
        self.Button_1.setObjectName("Button_1")

        self.Button_2 = QtWidgets.QPushButton(self.centralwidget)
        self.Button_2.setGeometry(QtCore.QRect(440, 110, 41, 41))
        self.Button_2.setObjectName("Button_2")

        self.Button_5 = QtWidgets.QPushButton(self.centralwidget)
        self.Button_5.setGeometry(QtCore.QRect(440, 260, 41, 41))
        self.Button_5.setObjectName("Button_5")

        self.Button_4 = QtWidgets.QPushButton(self.centralwidget)
        self.Button_4.setGeometry(QtCore.QRect(440, 210, 41, 41))
        self.Button_4.setObjectName("Button_4")

        self.Button_3 = QtWidgets.QPushButton(self.centralwidget)
        self.Button_3.setGeometry(QtCore.QRect(440, 160, 41, 41))
        self.Button_3.setObjectName("Button_3")

        self.Button_6 = QtWidgets.QPushButton(self.centralwidget)
        self.Button_6.setGeometry(QtCore.QRect(440, 310, 41, 41))
        self.Button_6.setObjectName("Button_6")

        self.Button_7 = QtWidgets.QPushButton(self.centralwidget)
        self.Button_7.setGeometry(QtCore.QRect(440, 360, 41, 41))
        self.Button_7.setObjectName("Button_7")

        #Верхняя менюшка
        MainWindow.setCentralWidget(self.centralwidget)
        self.menubar = QtWidgets.QMenuBar(MainWindow)
        self.menubar.setGeometry(QtCore.QRect(0, 0, 490, 21))
        self.menubar.setObjectName("menubar")

        self.menuSettings = QtWidgets.QMenu(self.menubar)
        self.menuSettings.setObjectName("menuSettings")

        self.menuProfile = QtWidgets.QMenu(self.menubar)
        self.menuProfile.setObjectName("menuProfile")

        MainWindow.setMenuBar(self.menubar)
        self.menubar.addAction(self.menuSettings.menuAction())
        self.menubar.addAction(self.menuProfile.menuAction())

        self.retranslateUi(MainWindow)
        QtCore.QMetaObject.connectSlotsByName(MainWindow)

    def retranslateUi(self, MainWindow):
        _translate = QtCore.QCoreApplication.translate
        MainWindow.setWindowTitle(_translate("MainWindow", "Биндяра(pyqt5)"))
        self.Forward_button.setText(_translate("MainWindow", "forward"))
        self.Copy_button.setText(_translate("MainWindow", "copy"))
        self.paste_button.setText(_translate("MainWindow", "paste"))
        self.change_button.setText(_translate("MainWindow", "change"))
        self.play_button.setText(_translate("MainWindow", "Play"))
        self.Stop_button.setText(_translate("MainWindow", "stop"))
        self.Delete_all_button.setText(_translate("MainWindow", "All"))
        self.Delete_line_button.setText(_translate("MainWindow", "Line"))
        self.Button_1.setText(_translate("MainWindow", "PushButton"))
        self.Button_2.setText(_translate("MainWindow", "PushButton"))
        self.Button_5.setText(_translate("MainWindow", "PushButton"))
        self.Button_4.setText(_translate("MainWindow", "PushButton"))
        self.Button_3.setText(_translate("MainWindow", "PushButton"))
        self.Button_6.setText(_translate("MainWindow", "PushButton"))
        self.Button_7.setText(_translate("MainWindow", "PushButton"))
        self.menuSettings.setTitle(_translate("MainWindow", "Settings"))
        self.menuProfile.setTitle(_translate("MainWindow", "Profile"))


if __name__ == "__main__":
    import sys
    app = QtWidgets.QApplication(sys.argv)
    MainWindow = QtWidgets.QMainWindow()
    ui = Ui_MainWindow()
    ui.setupUi(MainWindow)
    MainWindow.show()
    sys.exit(app.exec_())

Файл, где будут прописаны функции Function.py

import keyboard
import PrInterface
from PyQt5 import QtCore, QtWidgets, QtGui
from PyQt5.QtWidgets import QMessageBox
from PrInterface import *


class MyWindow(QtWidgets.QMainWindow, Ui_MainWindow):
    def __init__(self):
        super().__init__()
        self.setupUi(self)

        self.back_button.clicked.connect(self.printMe)


    def printMe(self):
        print('1')

    def tabl_func(self):
        pass

    def back_func(self):
        pass

    def forward_func(self):
        pass

    def save_func(self):
        pass

    def cut_func(self):
        pass

    def copy_func(self):
        pass

    def paste(self):
        pass

    def change_func(self):
        pass

    def up_func(self):
        pass

    def down_func(self):
        pass

    def play_func(self):
        pass

    def stop_func(self):
        pass

    def delall_func(self):
        pass

    def delline_func(self):
        pass

if __name__ == "__main__":
    import sys
    app = QtWidgets.QApplication(sys.argv)
    MainWindow = QtWidgets.QMainWindow()
    ui = MyWindow()
    ui.setupUi(MainWindow)
    MainWindow.show()
    sys.exit(app.exec_())

Ответы (1 шт):

Автор решения: S. Nick

Это делается так:

function.py:

import keyboard
#import prInterface
from PyQt5 import QtCore, QtWidgets, QtGui
from PyQt5.QtWidgets import QMessageBox
#from PrInterface import *
from prInterface import Ui_MainWindow               # !!!


class MyWindow(QtWidgets.QMainWindow, Ui_MainWindow):
    def __init__(self):
        super().__init__()
        self.setupUi(self)

        self.back_button.clicked.connect(self.printMe)

    def printMe(self):
        print('1 back_button')

    def tabl_func(self):
        pass

    def back_func(self):
        pass

    def forward_func(self):
        pass

    def save_func(self):
        pass

    def cut_func(self):
        pass

    def copy_func(self):
        pass

    def paste(self):
        pass

    def change_func(self):
        pass

    def up_func(self):
        pass

    def down_func(self):
        pass

    def play_func(self):
        pass

    def stop_func(self):
        pass

    def delall_func(self):
        pass

    def delline_func(self):
        pass

if __name__ == "__main__":
    import sys
    
    app = QtWidgets.QApplication(sys.argv)
    
#    MainWindow = QtWidgets.QMainWindow()
#    ui = MyWindow()
#    ui.setupUi(MainWindow)
#    MainWindow.show()

    w = MyWindow()                                         # +++
    w.show()                                               # +++
    
    sys.exit(app.exec_())

введите сюда описание изображения

→ Ссылка