Unable to use from_py_func

getting error for the line
callback = CustomJS. from_py_func(callback1)

AttributeError: type object ‘CustomJS’ has no attribute ‘from_py_func’

It had been deprecated and have been subsequently removed in Bokeh 2.0: https://docs.bokeh.org/en/2.0.0/docs/releases.html#api-removals

Thanks Eugene Pakhomov.
Any idea how can i use the functionality of from_py_func. Or any alternative for it?.

My organisation blocks the bokeh server JS so i have to use inline mode and CustomJS.

You have to write CustomJS code, yes.

The underlying third-party Python->JS transpiler library still exists (several others too, in fact). Presumedly you could install and use it directly to generate the JavaScript code for CustomJS callbacks. Or as mentioned, write JavaScript directly.

sorry that is way above me … what would that be the way to interact with the legend such as in here ?
Thanks for the tip

@foice There is an entire section of the User’s Guide dedicated to explaining and demonstrating CustomSJ callbacks:


It would be best if you take a look over that first, make a concrete stab at whatever it is you are trying to accomplish, and then open a new, focused question on here.

1 Like

Tried and failed. Posted for help. Thanks!