Using uic.loadUi rather than import canacondamainwindow and setupUi(). Renamed self.ui to self.mainWindow.