# Callback function not triggered

**URL:** <https://community.plotly.com/t/callback-function-not-triggered/47723>\
**Category:** Dash Python\
**Created:** [November 30, 2020, 10:08pm UTC](https://community.plotly.com/t/callback-function-not-triggered/47723 "2020-11-30T22:08:12Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![dibts](https://avatars.discourse-cdn.com/v4/letter/d/ed655f/32.png) [@dibts](https://community.plotly.com/u/dibts)\
**Post date:** [November 30, 2020, 10:08pm UTC](https://community.plotly.com/t/callback-function-not-triggered/47723/1 "2020-11-30T22:08:12Z")

</div>

Hello There,  
I m trying to make a UI that will help to label time series (600 seconds signal )data. In the interface 2 buttons switch between the time series.  
The function defined after the callback is actually never called  
Scouring the forum, I found similar problems and the solution didn’t work for me.  
Can anyone help me solving this disaster?  
Here is the code:

```auto
def dash(signal_type='strain',
         sensor,
         staring_date,
         port,
         project_db,
         data_root ,
         location ):

    app = JupyterDash( __name__ ,external_stylesheets=[dbc.themes.BOOTSTRAP])
    app.layout = html.Div([

        dbc.Row(
            dbc.Col(

                html.H1(children='Signal Labeling of '+str(signal_type), style = {'textAlign': 'center'}),
                width={'size':12, 'offset':0},
            ),
        ),

        dbc.Row([
            dbc.Col(
                dbc.Button(
                    'Previous Timestamp', id='previous', style=dict(width='100%', display='inline-block'), n_clicks=0),
                width=4

            ),
            dbc.Col(
                html.Div(
                     [staring_date],id='timestamp', style=dict(width='100%', display='inline-block')),
                width=4

            ),
            dbc.Col(
                dbc.Button(
                    'Next Timestamp', id='next', style=dict(width='100%', display='inline-block'), n_clicks=0
                ),
                width=4

            ),
        ]),
        dbc.Row([
            dbc.Col(
                dcc.Graph(id='graph'),
                width=10
            )

        ]),
        dbc.Row([
            dbc.Col(
                dcc.RangeSlider(
                    id='BoundaryEvent1',
                    min=0,
                    max=600,
                    step=1,
                    value=[0,600]
                ),
                width=10
            ),
            dbc.Col(
                dbc.Button(
                    'Event1', id='Event1', style=dict(width='100%', display='inline-block'), n_clicks=0

                ),
                width=2
            )
        ]),
        dbc.Row([
            dbc.Col(
                dcc.RangeSlider(
                    id='BoundaryEvent2',
                    min=0,
                    max=600,
                    step=1,
                    value=[0, 600]
                ),
                width=10
            ),
            dbc.Col(
                dbc.Button(
                    'Event2', id='Event2', style=dict(width='100%', display='inline-block'), n_clicks=0

                ),
                width=2
            )
        ])

        ])

    @app.callback(

         [Output('timestamp','children'),
          Output('graph','figure')],
        [Input('previous','n_clicks'),
         Input('next','n_clicks'),
         Input('timestamp','children')])

    def display_graph(previous,next,dt):
        print('I m triggered')
        ctx = dash.callback_context
        triggered_id = ctx.triggered[0]['prop_id'].split('.')[0]
        print(triggered_id)

        if triggered_id == 'previous':
            dt=dt-datetime.timedelta(minutes=10)

        elif triggered_id == 'next':
            dt = dt + datetime.timedelta(minutes=10)

        signal = dw.getTDMS(dt,signal_type , location, root=data_root, duration=1, database=project_db)
        data, layout = signal[sensor].plotly()
        fig = go.Figure(data=data, layout=layout)

        return dt,fig

    app.run_server(mode='inline', port=port)

```

The print (‘I m triggered’) doesn’t show anything.  
You also have the app layout here

 ![image_2020-11-30_231043](https://us1.discourse-cdn.com/flex024/uploads/plot/original/2X/4/481189ae704ac220d8ff3d9b6d5b941398579afc.png)  
Thank you in advance

---

<div class="post-metadata">

**Author:** ![AnnMarieW](https://avatars.discourse-cdn.com/v4/letter/a/ec9cab/32.png) [@AnnMarieW](https://community.plotly.com/u/AnnMarieW)\
**Post date:** [November 30, 2020, 11:56pm UTC](https://community.plotly.com/t/callback-function-not-triggered/47723/2 "2020-11-30T23:56:23Z")

</div>

Hi @dibts and welcome to the Dash community

Try removing the extra line between the `@app.callback` decorator and the callback function declaration. If there is a blank line the callback registration will not be successful.

I hope this will solve the disaster 😀

---

<div class="post-metadata">

**Author:** ![dibts](https://avatars.discourse-cdn.com/v4/letter/d/ed655f/32.png) [@dibts](https://community.plotly.com/u/dibts)\
**Post date:** [December 2, 2020, 4:09pm UTC](https://community.plotly.com/t/callback-function-not-triggered/47723/3 "2020-12-02T16:09:41Z")

</div>

Thank you for your quick response 🙂 It’s working now
