def start_server(self): p = Popen([sys.executable, os.path.abspath(main.__file__)], creationflags=CREATE_NEW_CONSOLE) Thread(target=self.watch_process, args=(self.toggle_server, p)).start() return p