Import @socketio.on() from another class in Flask Import @socketio.on() from another class in Flask flask flask

Import @socketio.on() from another class in Flask


The way you can do this is by moving the socketio.on() functions to a different module. You mention classes, but these are really functions, the way to structure your application is by separating the different parts of it into modules or packages.

Take a look at this example that I created to demonstrate one way to structure a Flask application that uses Flask-SocketIO.