Bokeh.embed.server_session model argument appears to not be used

I am attempting to embed bokeh models inside of a larger jinja template in an application served by flask. I can successfully embed the entire document without issues, but when I try to embed individual models within the document root, the entire document is embedded instead.

The server_session function header mentions the following argument:

model (Model or None, optional) :
The object to render from the session, or None. (default: None)
If None, the entire document will be rendered.

Digging in further, the modelid that is pulled from the passed model object within the function is only used to pass to the rendering of the AUTOLOAD_REQUEST_TAG, which in turn pulls from the autoload_request_tag.html file. That file has the following comment:

:param modelid: The Bokeh model id for the object to render (if missing, render
the whole doc; if present, only render the one model)

However, it does not appear that the modelid parameter is actually utilized in any way within the script template.

Am I misunderstanding the purpose of this argument, or is this functionality deprecated / unsupported?

This is the methodology that I am pulling the session with:

with pull_session(url=URL) as session:
    left_root = session.document.select_one({"name":"left_root"})
    assert left_root is not None
    left_root_script = server_session(model=left_root,, url=URL, resources=None)
    return render_template(

This is my first time posting here, so hopefully this is sufficiently detailed despite the lack of minimal reproducible example. If not please let me know.


Ah. After some more thorough searching, I came across [BUG] server_session does not allow models to be subselected, instead it renders entire document regardless of passed model parameter · Issue #9554 · bokeh/bokeh · GitHub and Bring back the functionality needed to embed separate Bokeh roots within React · Issue #8499 · bokeh/bokeh · GitHub.

Seems like this functionality being broken is a known issue.