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.