code: def edit_script(self, filename=None, goto=-1):
          
          # Called from InternalShell
          if not hasattr(self, 'main') \
             or not hasattr(self.main, 'editor'):
              self.shell.external_editor(filename, goto)
              return
          if filename is not None:
              self.edit_goto.emit(osp.abspath(filename), goto, '')
docs: Edit script