☰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

Force to open a new browser window with standalone bokeh server

Community Supportserver
thisuser
thisuser

I want to run python app.py and hope it opens a new browser window no matter whether a browser is already open or not. How to achieve this? Thanks!

Minium working example:

app.py

from bokeh.server.server import Server
from bokeh.models import TextInput


def make_document(doc):
    status_text = TextInput(title='', value='Ready', disabled=True,
                                     sizing_mode='stretch_width')
    doc.add_root(status_text, sizing_mode='stretch_width')


apps = {'/': make_document}
server = Server(apps)
server.start()
server.io_loop.add_callback(server.show, "/")
server.io_loop.start()
⌁   Link to post
Bryan
Bryan

Per the documentation you could try passing new="window" to open a new window every time (e.g. use functools.partial or lambda to bake in the different param value and pass the wrapper to add_callback).

However, please be advised that Server.show is really just a very thin wrapper on top of the Python stdlib webbrowser.open function. That function has a lot of platform-dependent, 'if possible", caveats. There is no guarantee that that what you ask for is possible on all platforms, or on the platform you happen to be using. YMMV and you will just have to try and see.

⌁   Link to post

End of archived discussion · Replies are disabled