☰Read-only archive⌕
Looking for help with Bokeh?

This is a read-only archive. Ask questions and join the conversation on GitHub.

Visit Community Support on GitHub →
Archived discussions · Captured October 28, 2026

Embed individual live graphs in Flask

Community Support
Patrick
Patrick

Dear bokeh community,
I am running a bokeh server with several live-update (streaming) figures, interactive widgets and also static components.
I am trying to embed parts(!) of that webpage into a flask webpage.
After trying very hard to get this to work i have the impression that i have the choice between two things:

  1. Use server_session or server_document to get the script code from the entire bokeh webpage. This can be successfully integrated into the html and the entire application can be nicely embedded into flask (keeping the live update and interactive functionality)
  2. Use script_k, div_k = component(session.document.roots[k]) to extract an individual component and then try to embed that in the html. However, doing so, the live upadate and interactive functionality is lost.

Is there a way to fetch individual components from the bokeh server side (figures, widgets, etc…), embed those at individual places in the flask app and keeping the functionality (live updates, interaction, etc…)

Would be great to get some more info on this! Thanks already in advance.

⌁   Link to post
Bryan
Bryan

The components API is only for standalone (i.e. non-server) content. It is not intended or suitable for Bokeh server apps. The options for apps are server_session and server_document

Is there a way to fetch individual components from the bokeh server side

In principle this should possible, however I have to be up front that it is very much not well-established practice. The server_session API accepts a model as its first parameter, which is intended to be able to render specific models from an existing session (e.g. initiated by pull_session). There are some basic unit tests for this usage but in nearly a decade almost no-one has ever asked about, so I can’t point to any concrete examples, either official or otherwise. (As with all things OSS, the most frequently used thigns get the most of limited maintainer bandwidth.)

⌁   Link to post

End of archived discussion · Replies are disabled