# ReactiveHTML: trigger python callback in the \_scripts object

**URL:** <https://discourse.holoviz.org/t/reactivehtml-trigger-python-callback-in-the-scripts-object/6135>\
**Category:** Panel\
**Tags:** reactivehtml\
**Created:** [October 3, 2023, 7:30am UTC](https://discourse.holoviz.org/t/reactivehtml-trigger-python-callback-in-the-scripts-object/6135 "2023-10-03T07:30:29Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Julien](https://discourse.holoviz.org/letter_avatar_proxy/v4/letter/j/71e660/32.png) [@Julien](https://discourse.holoviz.org/u/Julien)\
**Post date:** [October 3, 2023, 7:30am UTC](https://discourse.holoviz.org/t/reactivehtml-trigger-python-callback-in-the-scripts-object/6135/1 "2023-10-03T07:30:29Z")

</div>

Hi,

I am wondering if it’s possible to trigger a python callback in the \_scripts object in a ReactivHTML component.

For example, if we take the example given on the documentation [site](https://panel.holoviz.org/explanation/components/components_custom.html#callbacks) and modify slightly the example as follow this work:

```auto
import param
from panel.reactive import ReactiveHTML
import panel as pn
pn.extension() # for notebook

class Slideshow(ReactiveHTML):

    index = param.Integer(default=0)
    trigger = param.Integer(default=0)

    _template = '<img id="slideshow" src="https://picsum.photos/800/300?image=${index}" onclick="${script('click')}"></img>'

    _scripts = {
        'click': """
            data.trigger = data.trigger + 1
         """
   }

    @param.depends("trigger", watch=True)
    def _img_click(self):
        self.index += 1

Slideshow(width=800, height=300)

```

However, without using the depends decorator and the trick of incrementing the trigger param, how can one call the \_img\_click callback in the scripts object directly?

This example above is a bit silly and I know that one can call the \_img\_click callback directly on the image tag itself, but this is more like a general question to see if it’s possible to call directly a python callback in \_scripts in the situation where a python callback cannot be directly attached/triggered to a dom element.
