For a scripted loadable module, the module class will automatically create the widget based on the class name (MyModule, MyModuleWidget). You don’t need to add any code to the base Module class for this.
As mentioned on one of the slides “Current limitation: Scripted module logic is not created automatically, it has to be instantiated in the Widget class.” So as seen in the template the logic is instantiated in the widget class. (self.logic = MyModuleLogic()
)
If there are issues during startup loading order, they can usually be mitigated by utilizing the startupCompleted signal. See linked thread: