How to trigger bokeh callbacks using browser's javascript

Hello All!

I have a bokeh server document embedded within a flask application, and I want to be able to trigger a python callback on a bokeh widget from a button defined in the flask html/js.

My idea for doing so was to trigger the bokeh callback using the .dispatchEvent method (in order to trigger any ‘change’ events) on the widget in question, but that doesn’t seem to trigger the python callback. Is there any way to manually trigger bokeh python callbacks within the browser?

My reason for trying to do this is that I want to style the widgets in a way that allows more control in user interface design (namely outlines for groups of similar widgets, control of color on clicks and hovers, etc.), so I plan on hiding the original bokeh widgets and replacing them with my own html defined ones in the case that the above is a valid way of solving my problem. If there are any alternative methods to doing the same however, I’m all ears! Also if it would be of help, I could likely create a small reproducible example in github upon request.

Thank you for your help & time!