I try to call a method as thread then call another method while the StartServer method is background runing but when self.Thread.run() is executed, the code is stuck. Any ideas ? I try to put start server in another class, in a outside function but I still have that issue.
import time import webview import threading from flask import Flask class Windows: def __init__(self, EntryPoint = "index.html"): self.EntryPointContent = self.ReadPage(EntryPoint) self.Thread = threading.Thread(target = self.StartServer) self.Thread.daemon = True self.Thread.run() self.ShowWindows() def StartServer(self): app = Flask(__name__) app.debug = False app.reloader = False @app.route("/") def root(): return self.EntryPointContent app.run() def ReadPage(self, FileName): File = open(FileName, "r") return File.read() def ShowWindows(self): webview.create_window("Hey !", "http://localhost:5000") webview.start() app = Windows(EntryPoint="page.html")