Dash Trigger plotly Buttonbar Mode

I found in this URL https://codepen.io/destrada/pen/VbMJKy that you can customize the button trigger plotly lasso event.
How should I do it in dash?

My idea is to create a new js file in the assert directory.


But Plotly is not defined, do I need to introduce plotly?

I have solved it。like update title

from dash import Dash, html, dcc, Input, Output, Patch, callback
import plotly.express as px
import random

app = Dash(__name__)

df = px.data.iris()
fig = px.scatter(
    df, x="sepal_length", y="sepal_width", color="species", title="Updating Title Color"

app.layout = html.Div(
        html.Button("lasso", id="update-color-button-2"),
        dcc.Graph(figure=fig, id="my-fig"),

@callback(Output("my-fig", "figure"), Input("update-color-button-2", "n_clicks"))
def my_callback(n_clicks):
    # Creating a Patch object
    patched_figure = Patch()
    patched_figure["layout"]["dragmode"] = "lasso"
    return patched_figure

if __name__ == "__main__":