def handle_updateAvailChar(res): httpd.availChar = res print('updateAvailChar', httpd.availChar) def handle_checkConnection(res): httpd.allConnected = res def handle_updateSelectedChar(res): httpd.allConnected = res def handle_partnerMoved(res): httpd.movingChar = res #self.getRes(self.path+'/'+httpd.myChar+'/'+httpd.movingChar) httpd = HTTPServer(('localhost', 12345), SimpleHTTPRequestHandler) wsClient = WSClient() httpd.availChar = 'x' httpd.myChar = 'x' httpd.movingChar = 'x' httpd.dice = 0 httpd.allConnected = 0 threading.Thread(target=httpd.serve_forever).start() wsClient.loop = asyncio.get_event_loop() wsClient.loop.run_until_complete(wsClient.listen())