How to enable and disable a button within a callback?

Guys, can someone help me, because I have a problem for days in the following case:

When I click on a button I call a callback to do a search, only when I call this callback I wanted to disable the button and change its name, and on the return of this callback I wanted to enable it again and change the name, but I can’t no way … i already created another callback to do this, but it only comes in when i click and in the return it doesn’t come in anymore … follows a code snippet.

html.Button(
children=“Searching…”,
id=‘btn-search-period’,
disabled=True,
n_clicks=0,
n_clicks_timestamp=0,
className=“mr-1 btn btn-primary”,
style={‘display’: ‘inline-block’}
)

@app.callback(
[Output(‘analise-periodo’, ‘children’),
Output(‘btn-search-period’, ‘n_clicks_timestamp’)],
[Input(‘analise-periodo-trigger’, ‘children’),
Input(‘btn-search-period’, ‘n_clicks’)],
[State(‘sensor-info’, ‘children’),
State(‘date-picker-period’, ‘date’),
State(‘radio-button-period’, ‘value’)]
)
def load_analise_per_graphics(trigger, clicks, sensor_info, date_period, coordinate):
“”"
here’s my script
“”"

return analise_periodo_chart, 2

@app.callback(
[Output(‘btn-search-period’, ‘disabled’),
Output(‘btn-search-period’, ‘children’)],
[Input(‘btn-search-period’, ‘n_clicks’),
Input(‘btn-search-period’, ‘n_clicks_timestamp’)]
)
def change_button_search_period(clicks, clicks_timestamp):
if clicks_timestamp== ‘change’:
return False, ‘Search’
else:
return True, ‘Searching…’

the problem is that the {change_button_search_period} callback is only called at the end of {load_analise_per_graphics}, I thought {change_button_search_period} was called equally with {load_analise_per_graphics} when clicking. This worked for the previous version of DASH that I had, which was 1.8.0, when upgrading to version 1.13.4 it doesn’t work anymore, I’ve been out of ideas to solve this for a while.

How do I solve this problem? Does anyone have any suggestions on how to solve this problem:

1 - Click the button
2 - Call function to execute script
3 - Disable button and change name
4 - Run script
5 - Enable button and change name