☰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

BokehJS: How to remove all bokeh objects from Bokeh.index?

Community Supportbrowsercustomjsbokehjswebsitebokeh
mrblue6ix
mrblue6ix

I have some functions which only get run correctly if my Bokeh plot has already been rendered onto the html page. Eg. Custom Toolbar gets placed underneath the plot, so need to wait until its been created.

I’m also adding 5 color pickers for each graph.

The problem:
When I regenerate the plot, the new plot and color pickers are added to Bokeh.index:
ie. 6 items are added each time I generate

Current workaround:
Haven’t actually implemented but should be trivial. I have a global variable keeping track of the index of the newest plot that has been generated, and my functions can check for the existence of that index in Bokeh.index.

The Question:
Is there a way to delete/remove the old plot/pickers from Bokeh.index?
May have use cases of generating many plots, so I feel my workaround might be a bit space inefficient because the old objects are still there.

⌁   Link to post
mrblue6ix
mrblue6ix

Answered my own question:

Simply can delete stuff from Bokeh.index the same as deleting from JS objects (Bokeh.index is JS Object)

let bok_ind = Object.keys(Bokeh.index);
    for(let i = 0; i < bok_ind.length; i += 1){
        delete Bokeh.index[bok_ind[i]];
    }
⌁   Link to post

End of archived discussion · Replies are disabled