Calling class that initiates UI class in python
<p>I have an issue while creating my small Python project. I am used to Java and this is still quite new to me. 
The problem is i create a UI class from QtCreator. Then convert it to <code>.py</code> and import to my project. I have a class that for now is considered <code>main</code> that initiates and runs the UI class. The problem is i need to have a class that is really the <code>main</code> class and when app is started this class to call the second class that initiates the UI. 
To sum it up now when app is started i have <code>A &gt; calls &gt; B(UI)</code>. 
I need it to be <code>A &gt; calls &gt; B &gt; init &gt; C(UI)</code>.
Is that possible? My idea is that B must be only a manager class that sets up the UI and run it. 
Here is my working code so far:
1.Manager class- </p>

<pre><code>class mainpanelManager(QtWidgets.QMainWindow, Ui_MainWindow):
    def __init__(self):
        super().__init__()
        self.setupUi(self)
if __name__ == "__main__":
    app = QtWidgets.QApplication(sys.argv)
    window = mainpanelManager()
    window.show()
    sys.exit(app.exec_())
</code></pre>

<p>and UI class is typical UI generated class. I will post only constructor:</p>

<pre><code>class Ui_MainWindow(QtGui.QWindow):
    def setupUi(self, MainWindow):
</code></pre>

<p>In this case <code>mainpaneManager</code> runs <code>Ui_MainWindow</code> after element initiation.
I want to have a 3rd class that calls <code>mainpanelManager</code>. 
What do i do with this <code>__name__</code> function? Move it?
Thanks in advance!</p>

<p>I'm not exactly sure I understand what you're asking for, but it would seem to be as simple as this:</p>

<pre><code>class Main(object):
    def __init__(self):
        self.window = MainPanelManager()
        self.window.show()             

class MainPanelManager(QtWidgets.QMainWindow, Ui_MainWindow):
    def __init__(self):
        super().__init__()
        self.setupUi(self)
        self.settingsButton.clicked.connect(self.editSettings)
        self.loadSettings()

    def editSettings(self):
        dialog = SettingsDialog(self)
        if dialog.exec_() == QtWidgets.QDialog.Accepted:
            self.loadSettings()

    def loadSettings(self):
        # do stuff to load settings...

if __name__ == "__main__":

    app = QtWidgets.QApplication(sys.argv)
    main = Main()
    sys.exit(app.exec_())
</code></pre>

python pyqt qt5 qt-creator