On_change callback is not called

Hi

I set updatemenu buttons to change meta attributes in traces.

I expect that after clicking on the button, on_change event will be triggered on the trace.

But set callback is never called.

Can you tell please why this event is not triggered?

I am running this code in Databricks environment.

Here’s the chart code:

import plotly.graph_objs as go
import pandas as pd

df = pd.DataFrame({'index': ['1', '2', '3'], 'A': [1, 1, 2], 'B': [2, 2, 1]})

fig = go.FigureWidget()
fig.add_trace(go.Scatter(x=df['index'], y=df['A'], mode='lines', meta='initial', hovertemplate='<br>'.join(['x: %{x}', 'y: %{y}', 'meta: %{meta}'])))
fig.add_trace(go.Scatter(x=df['index'], y=df['B'], mode='lines', meta='initial', hovertemplate='<br>'.join(['x: %{x}', 'y: %{y}', 'meta: %{meta}'])))

buttons = [
    dict(
        args=[{'meta': ['button1'] * 2}, {'title': 'Button 1 was clicked'}, [0, 1]],
        label='button1',
        method='update'
    ),
    dict(
        args=[{'meta': ['button2'] * 2}, {'title': 'Button 2 was clicked'}, [0, 1]],
        label='button2',
        method='update'
    )
]

fig.update_layout(
    updatemenus=[
        go.layout.Updatemenu(
            buttons=buttons,
            direction='down',
            pad={'r': 10, 't': 10},
            showactive=True,
            x=-0.25,
            xanchor='left',
            y=1,
            yanchor='top'
        ),
    ]
)


def callback_fn(trace, meta):
    with fig.batch_update():
        # Custom code here which is not invoked.
        fig.data[0].line_color = 'green'
        fig.data[1].line_color = 'green'


fig.data[0].on_change(callback_fn, 'meta')
fig.data[1].on_change(callback_fn, 'meta')

fig.show()

Thanks in advance.