☰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

Bug or intended behaviour in embed.json_item()

Community Support
cjw85
cjw85

The docstring to the above function suggests it can be used to create json for embedding standalone Bokeh content. In my usecase I want to output the json representation of a plot (for an external service) but also use the plot immediately in my python application.

Using embed.json_item(plot), followed by layout(plot) leads to errors that: RuntimeError: Models must be owned by only a single document. This can be avoided by using the APIs that json_item() uses internally in a slightly different manner. Namely if the OutputDocumentFor is used with the always_new=True option (which json_item() does not set).

I’m wondering if this is intended behaviour or an oversight and that perhaps json_item() should optionally expose the always_new option of OutputDocumentFor.

⌁   Link to post
Bryan
Bryan

Seems like a small bug / oversight. The use-case that was in mind for the development of json_item was e.g. embedding from a Flask endpoint. I don’t imagine the scenario you describe was ever considered. Please open a GitHub Issue.

⌁   Link to post

End of archived discussion · Replies are disabled