def set_shellwidget(self, shellwidget):
    'Bind shellwidget instance to namespace browser'
    self.shellwidget = shellwidget
    from spyderlib.widgets import internalshell
    self.is_internal_shell = isinstance(self.shellwidget, internalshell.InternalShell)
    self.is_ipykernel = self.shellwidget.is_ipykernel
    if (not self.is_internal_shell):
        shellwidget.set_namespacebrowser(self)
Bind shellwidget instance to namespace browser
def set_shellwidget(self, shellwidget):
    
    self.shellwidget = shellwidget
    from spyderlib.widgets import internalshell
    self.is_internal_shell = isinstance(self.shellwidget, internalshell.InternalShell)
    self.is_ipykernel = self.shellwidget.is_ipykernel
    if (not self.is_internal_shell):
        shellwidget.set_namespacebrowser(self)