
I am attempting to create a simple bokeh-server app which can be accessed by multiple users at once. My understanding is that each user is automatically allocated a separate “Document” such that the values of their models (sliders, plots, etc) is independent of other users. However, in order to use certain python callbacks (e.g., a button callback which cannot take inputs), I had to create some python globals to expose certain variables to those callback functions.
Unfortunately, it appears that those python globals in the app file are not independent for multiple users accessing the same bokeh server — I tested this with two separate ssh logins to one bokeh server, and indeed, while they seemed mostly separate, when both sessions attempted to pull/modify Models which rely on combination of those globals, they got confused/overwritten with one another, leading to nonsense.
I saw some advice that basically said “the document is the thing each user gets separately, so just attach any needed session variables to the document.” This makes sense to me in principle, but when I look at how things are added to the root of the curdoc, it appears it is looking specifically for Model objects.
Does anyone have any advice for how to add regular python variables to the current session/document such that when multiple users attach to one bokeh server, those variables are unique to their session?
It appears as though one option might be to create a custom Model object to add to root. This seems nontrivial because the information I am trying to store/pass around is stored in objects (e.g., an astropy WCS or SkyCoord object). Otherwise I could I suppose instantiate a PlainText model as a dummy to store info (though it would need to be added to root but never displayed anywhere).
Grateful for any advice!

