☰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

Dynamically create bokeh serve - directory format

Community Supportserver
Callum
Callum

I have a single script which can dynamically create a Bokeh Server.

Is there a similar way of dynamically launching if the Bokeh Server is in directory format? (Explained here):

This is a simplified version of my current method of dynamically creating a script. (I need it to be able to launch as an .exe).

from bokeh.layouts import column
from bokeh.models import Button
from bokeh.plotting import figure, curdoc
from bokeh.server.server import Server

def standalone(doc):

    b1 = Button(label='b1')
    b2 = Button(label='b2', visible=False)

    def switcharoo():
        if b1.visible == True:
            b1.visible = False
            b2.visible = True
        else:
            b1.visible = True
            b2.visible = False

    # put the button and plot in a layout and add to the document
    b1.on_click(switcharoo)
    b2.on_click(switcharoo)
    doc.add_root(column(b1, b2))

server = Server({'/': standalone}, num_procs=1)
server.start()

server.io_loop.add_callback(server.show, "/")
server.io_loop.start()

⌁   Link to post

End of archived discussion · Replies are disabled