code: def configure_shellwidget(self, give_focus=True):
          
          if give_focus:
              self.get_control().setFocus()
  
          # Set exit callback
          self.shellwidget.set_exit_callback()
  
          # To save history
          self.shellwidget.executing.connect(self.add_to_history)
  
          # For Mayavi to run correctly
          self.shellwidget.executing.connect(
              self.shellwidget.set_backend_for_mayavi)
  
          # To update history after execution
          self.shellwidget.executed.connect(self.update_history)
  
          # To update the Variable Explorer after execution
          self.shellwidget.executed.connect(
              self.shellwidget.refresh_namespacebrowser)
  
          # To enable the stop button when executing a process
          self.shellwidget.executing.connect(self.enable_stop_button)
  
          # To disable the stop button after execution stopped
          self.shellwidget.executed.connect(self.disable_stop_button)
  
          # To show kernel restarted/died messages
          self.shellwidget.sig_kernel_restarted.connect(
              self.kernel_restarted_message)
  
          # To correctly change Matplotlib backend interactively
          self.shellwidget.executing.connect(
              self.shellwidget.change_mpl_backend)
  
          # To show env and sys.path contents
          self.shellwidget.sig_show_syspath.connect(self.show_syspath)
          self.shellwidget.sig_show_env.connect(self.show_env)
  
          # To sync with working directory toolbar
          self.shellwidget.executed.connect(self.shellwidget.get_cwd)
  
          # To apply style
          self.set_color_scheme(self.shellwidget.syntax_style, reset=False)
  
          # To hide the loading page
          self.shellwidget.sig_prompt_ready.connect(self._hide_loading_page)
  
          # Show possible errors when setting Matplotlib backend
          self.shellwidget.sig_prompt_ready.connect(
              self._show_mpl_backend_errors)
docs: Configure shellwidget after kernel is started