Trying to print/export BokehJS plot, how can I do this..? How to use export_png()?

Ah apologies, I’m on version 3.0.3.

logging Bokeh.index to the console gives:

Object {  }
​
E6346ADE05324C4B904BD938D7BBDB91: Object { removed: {…}, _removed: false, _idle_notified: true, … }
​
<prototype>: Object { … }

I only have the 1 plot, so I assume this one entry is my plot.
How do I get the PlotView from this?

In my js file:

Object.keys(Bokeh.index); //returned empty array
Object.values(Bokeh.index); //returned empty array
Bokeh.index[0]; //returned undefined
Bokeh.index.toString(); //returned [object Object]

When I run Object.keys(Bokeh.index) in the browser (Chrome) console, it correctly prints out

Array [ "DC572550235F4541AFB693288C7E925F" ]
​
0: "DC572550235F4541AFB693288C7E925F"
​
length: 1
​
<prototype>: Array []

But as above, when I do it in my js file, it returns an empty array. Would you know what the issue is here?

Edit: I figured out why I was getting different results in console and js file. Bokeh.Index I guess had not updated. I set a timeout for 5 secs and seems to be working now

Thanks