# Unable to use from\_py\_func

**URL:** <https://discourse.bokeh.org/t/unable-to-use-from-py-func/5068>\
**Category:** Community Support\
**Created:** [April 1, 2020, 12:03pm UTC](https://discourse.bokeh.org/t/unable-to-use-from-py-func/5068 "2020-04-01T12:03:54Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![SubhamSharma1996](https://discourse.bokeh.org/letter_avatar_proxy/v4/letter/s/f6c823/32.png) [@SubhamSharma1996](https://discourse.bokeh.org/u/SubhamSharma1996)\
**Post date:** [April 1, 2020, 12:03pm UTC](https://discourse.bokeh.org/t/unable-to-use-from-py-func/5068/1 "2020-04-01T12:03:54Z")

</div>

getting error for the line  
callback = CustomJS. from\_py\_func(callback1)

AttributeError: type object ‘CustomJS’ has no attribute ‘from\_py\_func’

---

<div class="post-metadata">

**Author:** ![p-himik](https://discourse.bokeh.org/user_avatar/discourse.bokeh.org/p-himik/32/4010_2.png) [@p-himik](https://discourse.bokeh.org/u/p-himik)\
**Post date:** [April 1, 2020, 12:27pm UTC](https://discourse.bokeh.org/t/unable-to-use-from-py-func/5068/2 "2020-04-01T12:27:01Z")

</div>

It had been deprecated and have been subsequently removed in Bokeh 2.0: [Releases — Bokeh 2.0.0 Documentation](https://docs.bokeh.org/en/2.0.0/docs/releases.html#api-removals)

---

<div class="post-metadata">

**Author:** ![SubhamSharma1996](https://discourse.bokeh.org/letter_avatar_proxy/v4/letter/s/f6c823/32.png) [@SubhamSharma1996](https://discourse.bokeh.org/u/SubhamSharma1996)\
**Post date:** [April 1, 2020, 12:31pm UTC](https://discourse.bokeh.org/t/unable-to-use-from-py-func/5068/3 "2020-04-01T12:31:14Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![p-himik](https://discourse.bokeh.org/user_avatar/discourse.bokeh.org/p-himik/32/4010_2.png) [@p-himik](https://discourse.bokeh.org/u/p-himik)\
**Post date:** [April 1, 2020, 2:12pm UTC](https://discourse.bokeh.org/t/unable-to-use-from-py-func/5068/4 "2020-04-01T14:12:46Z")

</div>

You have to write `CustomJS` code, yes.

---

<div class="post-metadata">

**Author:** ![Bryan](https://discourse.bokeh.org/user_avatar/discourse.bokeh.org/bryan/32/3625_2.png) [@Bryan](https://discourse.bokeh.org/u/Bryan)\
**Post date:** [April 1, 2020, 2:39pm UTC](https://discourse.bokeh.org/t/unable-to-use-from-py-func/5068/5 "2020-04-01T14:39:15Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![foice](https://discourse.bokeh.org/letter_avatar_proxy/v4/letter/f/4da419/32.png) [@foice](https://discourse.bokeh.org/u/foice)\
**Post date:** [August 12, 2020, 9:48am UTC](https://discourse.bokeh.org/t/unable-to-use-from-py-func/5068/6 "2020-08-12T09:48:56Z")

</div>

sorry that is way above me … what would that be the way to interact with the legend such as in [here](https://stackoverflow.com/questions/48511036/is-there-a-way-to-interactively-turn-off-the-legend-in-a-python-bokeh-plot) ?  
Thanks for the tip

---

<div class="post-metadata">

**Author:** ![Bryan](https://discourse.bokeh.org/user_avatar/discourse.bokeh.org/bryan/32/3625_2.png) [@Bryan](https://discourse.bokeh.org/u/Bryan)\
**Post date:** [August 12, 2020, 8:47pm UTC](https://discourse.bokeh.org/t/unable-to-use-from-py-func/5068/7 "2020-08-12T20:47:09Z")

</div>

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

[JavaScript callbacks — Bokeh 2.4.2 Documentation](https://docs.bokeh.org/en/latest/docs/user_guide/interaction/callbacks.html)

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.

---

<div class="post-metadata">

**Author:** ![foice](https://discourse.bokeh.org/letter_avatar_proxy/v4/letter/f/4da419/32.png) [@foice](https://discourse.bokeh.org/u/foice)\
**Post date:** [August 13, 2020, 8:55am UTC](https://discourse.bokeh.org/t/unable-to-use-from-py-func/5068/8 "2020-08-13T08:55:16Z")

</div>

Tried and failed. [Posted for help](https://discourse.bokeh.org/t/callback-to-access-the-figure-itself/6134). Thanks!

---

<div class="post-metadata">

**Author:** ![system](https://discourse-uploads.bokeh.org/original/2X/1/14eb24f9e10e4e9b78e3f10f66c04ffa96446e5a.svg) [@system](https://discourse.bokeh.org/u/system)\
**Post date:** [July 21, 2021, 9:23pm UTC](https://discourse.bokeh.org/t/unable-to-use-from-py-func/5068/9 "2021-07-21T21:23:28Z")

</div>


