Okay here is an example from which you should be able to extrapolate what you are trying to do. If you have any questions about it or how to expand upon it just ask.
#from PyQt5.QtCore import * from PyQt5.QtGui import QFont from PyQt5.QtWidgets import QApplication, QMainWindow, QHBoxLayout, QVBoxLayout from PyQt5.QtWidgets import QWidget, QLabel, QPushButton, QStackedWidget class Prototyper(QWidget): def __init__(self, parent, type) : QWidget.__init__(self) self.CntrPane = parent self.WdgtId = type Font = QFont() Font.setFamily('Times New Roman') Font.setPointSize(24) Font.setBold(True) WdgtName = 'Proto Widget ' + str(self.WdgtId) self.lblWdgtNam = QLabel(WdgtName) self.lblWdgtNam.setFont(Font) self.btnChange = QPushButton() if self.WdgtId == 1: self.btnChange.setText('Goto Two') else: self.btnChange.setText('Goto One') self.btnChange.clicked.connect(self.Switcher) HBox = QHBoxLayout() HBox.addWidget(self.btnChange) HBox.addStretch(1) VBox = QVBoxLayout() VBox.addWidget(self.lblWdgtNam) VBox.addLayout(HBox) VBox.addStretch(1) self.setLayout(VBox) # Note instead of making a callback you could use a Signal/Slot # but only if you feel that is something your program may need # as there is nothing wrong with a callback either they are simply # two different methodologies for different purposes and I reserve # adding the complexity of Signals/Slots to only where appropriate def Switcher(self): print('Switching') self.CntrPane.SwitchWidget(self.WdgtId) class CentralPanel(QWidget): def __init__(self, parent): QWidget.__init__(self) self.MainWin = parent self.WidgetOne = Prototyper(self, 1) self.WidgetTwo = Prototyper(self, 2) self.Contents = QStackedWidget() self.Contents.addWidget(self.WidgetOne) self.Contents.addWidget(self.WidgetTwo) HBox = QHBoxLayout() HBox.addWidget(self.Contents) self.setLayout(HBox) def SwitchWidget(self, WdgtId): print(WdgtId) if WdgtId == 1: self.Contents.setCurrentIndex(1) else: self.Contents.setCurrentIndex(0) class MainApp(QMainWindow) : def __init__(self) : # Do not use Super( ) unless you understand the 3 critical issues it creates that you have # to adjust your program for especially since the reason you might need it is very rare QMainWindow.__init__(self) self.setWindowTitle('DDM Corrector') Top = 200; Left = 700; Wdth = 1140; Hght = 653 self.setGeometry(Left, Top, Wdth, Hght) self.CenterPane = CentralPanel(self) self.setCentralWidget(self.CenterPane) if __name__ == '__main__': MainEvntHndlr = QApplication([]) MainApp = MainApp() MainApp.show() MainEvntHndlr.exec()