Bug or intended behaviour in embed.json_item()

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.

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.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.