code: def register_plugin(self):
          
          self.focus_changed.connect(self.main.plugin_focus_changed)
          self.main.add_dockwidget(self)
          # Connecting the following signal once the dockwidget has been created:
          self.shell.exception_occurred.connect(self.exception_occurred)
docs: Register plugin in Spyder's main window