Some ideas (without the benefit of a minimal reproducible example) …
-
Rework your callback so that the logic after setting the Div model to visible so all remaining code in the current callback is invoked via a add_next_tick_callback(…)
-
Use panel at the top-level of your code … it can be used as a thin wrapper to bokeh and the panel server is the bokeh server. Panel includes a LoadingSpinner widget that can indicate busy state.
https://panel.holoviz.org/reference/indicators/LoadingSpinner.html
Regarding 1, I think what might be happening is similar to the behavior discussed in this Discourse topic.
https://discourse.bokeh.org/t/div-not-updating-immediately/4134