code: def interact_plain(header=UP_LINE, local_ns=None,
                     module=None, dummy=None,
                     stack_depth=1, global_ns=None):
      
      frame = sys._getframe(stack_depth)
  
      variables = {}
  
      if local_ns is not None:
          variables.update(local_ns)
      else:
          variables.update(frame.f_locals)
  
      if global_ns is not None:
          variables.update(local_ns)
      else:
          variables.update(frame.f_globals)
  
      shell = code.InteractiveConsole(variables)
      return shell.interact(banner=header)
docs: Create an interactive python console