In my app.py, I do:
app = Flask(__name__)
app.register_blueprint(views.SOMETHING)
socketio = SocketIO(app, ...)
I need to use this socketio object, or more specifically, its socketio.emit method, to talk to clients.
I need to do this from multiple Python modules, like my views module, and some modules that define some background threads.
When I'm starting my background threads, it's pretty easy to pass the socketio object to them, but I can't figure out how to make this object accessible in my views module where all my views are defined.
The only thing I can think of is to have a global_vars module that I store the socketio object on, which can be imported from multiple Python modules, but I've heard that that's bad practice.
Is there a better way to pass my socketio object to my views module?