Nested callback

Hi,
I have the following scripts:

import dash
import dash_core_components as dcc
import dash_html_components as html
import dash_bootstrap_components as dbc
import time
from dash.dependencies import Input, Output, State

app = dash.Dash(name,suppress_callback_exceptions=True)

app.layout = html.Div([
dcc.Loading(
children=html.Div(
id=‘form’,
)
),

html.Div(id='project-id')

])

@app.callback(dash.dependencies.Output(‘form’, ‘children’),
dash.dependencies.Input(‘project-id’, ‘children’)
)

def load_form(project_id):
time.sleep(2) # indicate it takes some time to load the data, it takes the project id to
# create the tissues, for simplicity, i use a simple list instead
tissues = [‘A’,‘B’,‘C’]
return (
dbc.Form(
children=dbc.FormGroup([
dbc.Label(‘Tissue’,html_for=‘tissue’),
dcc.Dropdown(
options=[
{‘label’: c, ‘value’: c} for c in tissues
] ,
id=‘tissue’,
value=‘A’
)
])
),
dcc.Loading(
children=html.Div(
id=‘my-plot’
)
),
)

@app.callback(dash.dependencies.Output(‘my-plot’, ‘children’),
[dash.dependencies.Input(‘tissue’, ‘value’)])
def load_plot(tissue):
time.sleep(2) # it takes the tissue and generate a plot, here i use text to represent the
#changes in tissue
return html.Div([
html.H1('you choose ’ + tissue)
])

if name == ‘main’:
app.run_server(port=8882, debug=True)

The idea is: there is a form, then base on the options on the form to load a plot, here i just use a text to replace to plot for simplicity.

When I run the above scripts, initially it loads fine.
However, when i change the option of the dropdown, i expect the form( id=‘form’) will stay, only the plot(id=‘my-plot’) will reload. i.e. the first call back only call once.
But it is not, both form and my-plot session are reloaded. It is very weird.

How can I make the form to load only once?

Any advice are very welcome.

Thank in advance!
Greenfield

But Popover doesn’t have a ‘disable’ property either or am I missing something?

What is the ‘autohide’ property of dbc.Tooltip doing atm if now hiding the tooltip? My Pasco Connect