def open_file(self, path, line=None):
editor = None<EOL>if path:<EOL><INDENT>interpreter, pyserver, args = self._get_backend_parameters()<EOL>editor = self.tabWidget.open_document(<EOL>path, None, interpreter=interpreter, server_script=pyserver,<EOL>args=args)<EOL>if editor:<EOL><INDENT>self.setup_editor(editor)<EOL><DEDENT>self.recent_files_manager.open_file(path)<EOL>self.menu_recents.update_actions()<EOL><DEDENT>if line is not None:<EOL><INDENT>TextHelper(self.tabWidget.current_widget()).goto_line(line)<EOL><DEDENT>return editor<EOL>
Creates a new GenericCodeEdit, opens the requested file and adds it
to the tab widget.

:param path: Path of the file to open

:return The opened editor if open succeeded.