✊🏿 Black Lives Matter. Please consider donating to Black Girls Code today.
🐇 Announcing Dash VTK for 3d simulation graphics. Check out the March webinar.

Create callback with decorator

why this:

def create_callback_slider(output,c):
    def update_slider(value,c):
        return '{} ({} - {})'.format(c,value[0],value[1])
    return update_slider

for i in todosValores:
    if (data[i].dtype == "int64" or data[i].dtype == "float64" and (len(data[i].dropna().unique())) > 10 ):
        dynamically_generated_function = create_callback_slider(i,c=i)
        app.callback(
            Output('label-{}'.format(i),'children'),
            [Input('{}'.format(i),'value')]
            )
        (dynamically_generated_function)

give me the next error:

Exception on /_dash-update-component [POST]
Traceback (most recent call last):
File “C:\Users\pepe\AppData\Local\conda\conda\envs\Cadiz\lib\site-packages\flask\app.py”, line 2446, in wsgi_app
response = self.full_dispatch_request()
File “C:\Users\pepe\AppData\Local\conda\conda\envs\Cadiz\lib\site-packages\flask\app.py”, line 1951, in full_dispatch_request
rv = self.handle_user_exception(e)
File “C:\Users\pepe\AppData\Local\conda\conda\envs\Cadiz\lib\site-packages\flask\app.py”, line 1820, in handle_user_exception
reraise(exc_type, exc_value, tb)
File “C:\Users\pepe\AppData\Local\conda\conda\envs\Cadiz\lib\site-packages\flask_compat.py”, line 39, in reraise
raise value
File “C:\Users\pepe\AppData\Local\conda\conda\envs\Cadiz\lib\site-packages\flask\app.py”, line 1949, in full_dispatch_request
rv = self.dispatch_request()
File “C:\Users\pepe\AppData\Local\conda\conda\envs\Cadiz\lib\site-packages\flask\app.py”, line 1935, in dispatch_request
return self.view_functionsrule.endpoint
File “C:\Users\pepe\AppData\Local\conda\conda\envs\Cadiz\lib\site-packages\dash_auth\basic_auth.py”, line 33, in wrap
response = f(*args, **kwargs)
File “C:\Users\pepe\AppData\Local\conda\conda\envs\Cadiz\lib\site-packages\dash\dash.py”, line 1457, in dispatch
response.set_data(self.callback_map[output]“callback”)
KeyError: ‘callback’

SOLVED!!