code: def start_interpreter(self, namespace):
          
          self.clear()
          
          if self.interpreter is not None:
              self.interpreter.closing()
          self.interpreter = Interpreter(namespace, self.exitfunc,
                                         SysOutput, WidgetProxy,
                                         get_debug_level())
          self.interpreter.stdout_write.data_avail.connect(self.stdout_avail)
          self.interpreter.stderr_write.data_avail.connect(self.stderr_avail)
          self.interpreter.widget_proxy.sig_set_readonly.connect(self.setReadOnly)
          self.interpreter.widget_proxy.sig_new_prompt.connect(self.new_prompt)
          self.interpreter.widget_proxy.sig_edit.connect(self.edit_script)
          self.interpreter.widget_proxy.sig_wait_input.connect(self.wait_input)
          if self.multithreaded:
              self.interpreter.start()
          
          # Interpreter banner
          banner = create_banner(self.message)
          self.write(banner, prompt=True)
  
          # Initial commands
          for cmd in self.commands:
              self.run_command(cmd, history=False, new_prompt=False)
                  
          # First prompt
          self.new_prompt(self.interpreter.p1)
          self.refresh.emit()
  
          return self.interpreter
docs: Start Python interpreter