render_template with bokeh Panels and tabs

Hi,

I have used bokeh server with the code below, to display an array of images 2 columns in different tabs of the browser:

fxtabs =
# 4 rows of plots per tab
nrowpl = 4
for ii in range(int(math.ceil(len(p2D)/(1.*nrowpl)))):
# for testing purposes
ptab = layout(p2D[(ii)*nrowpl:(ii+1)*nrowpl])
fxtabs.append(Panel(child=ptab, title=“p”+str(ii)))
tabs = Tabs(tabs=fxtabs)
curdoc().add_root(tabs)
where p2D is an List of List of bokeh plots.

Now I would like to use these plots within a flask application and embed the plots in a html page.

To this end I tried the following code, to display all tabs:

script, div = components(tabs)
# print script
return render_template(‘bokeh.html’, result=(head, script, div))

However bokeh complains about the Panel function above.

If instead I use ptab above it displays fine, using the following code:

script, div = components(ptab)
# print script
return render_template(‘bokeh.html’, result=(head, script, div))

Can someone help?