code: def add_shellwidget(self, shellwidget):
          
          shellwidget_id = id(shellwidget)
          if shellwidget_id not in self.shellwidgets:
              self.options_button.setVisible(True)
              nsb = NamespaceBrowser(self, options_button=self.options_button)
              nsb.set_shellwidget(shellwidget)
              nsb.setup(**self.get_settings())
              nsb.sig_option_changed.connect(self.change_option)
              nsb.sig_free_memory.connect(self.free_memory)
              self.add_widget(nsb)
              self.shellwidgets[shellwidget_id] = nsb
              self.set_shellwidget_from_id(shellwidget_id)
              return nsb
docs: Register shell with variable explorer.
  
          This function opens a new NamespaceBrowser for browsing the variables
          in the shell.