I\'m currently developing a Python application on which I want to see real-time statistics. I wanted to use Flask in order to make it easy to use and to underst
You're running Flask in debug mode, which enables the reloader (reloads the Flask server when your code changes).
Flask can run just fine in a separate thread, but the reloader expects to run in the main thread.
To solve your issue, you should either disable debug (app.debug = False), or disable the reloader (app.use_reloader=False).
Those can also be passed as arguments to app.run: app.run(debug=True, use_reloader=False).