☰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

Trigger JS-function in code

Community Supportcustomjs
hanne
hanne

Hi,

I am trying to run some Javascript-code directly in Python (I want to focus on a text input). In Bokeh 2, I used to create a dummy element with the CustomJS as a callback. I understand that with Bokeh 3.5, it is possible to run CustomJS directly (by calling CustomJS.trigger). But I cannot find documentation on this, and am not able to do it.

How can I execute JS-code directly?

⌁   Link to post
Bryan
Bryan

I’m not sure what gave you the impression, but it’s not the case. trigger is an implementation detail that unfortunately and unavoidably poked through. It’s not really meant to be used be users, which is why it is not documented.

With recent versions of Bokeh, you can define your own DataModel subclass for triggering change events, which is a bit nicer than re-purposing some random hidden object as before. I’ve described that approach here several times before that you can search for.

⌁   Link to post

End of archived discussion · Replies are disabled