Black Lives Matter. Please consider donating to Black Girls Code today.

Error ID with callback

Using Dash I have the following problem:

If I have app.py and app.layout in that file consists of sub-layout.layout, if that sub-layout.layout is called two times (or more) in app.layout I get the error of duplicate key IDs.

In other words, I need to use a sub-layout more times and it must be updated. The IDs however, should not be included due to the error but should consist in sub-layout.layout to update them.

Is there any way to solve this?

#app.py
import dash
import dash_core_components as dcc
import dash_html_components as html
from dash.dependencies import Input, Output
app = dash.Dash(name)
app.layout = html.Div([sub-layout.layout, sub_layout.layout])

#sub_layout.py
import dash_html_components as html
import dash_core_components as dcc
layout = html.Div([html.H1(‘Time’, id=‘time_update’),html.Div(id=‘output’)])
@app.callback
def time_ticker(…):

ERROR: duplicate key IDs

Is there a workaround?