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

Error while linking update function to widgents

Hi everybody,
I am new to plotly dash and trying to make a stacked bar chart based on a pandas df. it works for one df but when I try to make a function to have a plot for each location and link it to a Dropdown widget I get an error. please help me.

def update_plot(locations):
    '''locations: list'''
    data = []
    for idx in range(len(locations)):
        trace = (
            go.Bar(name='{}'.format(i), x=invest_dfs[idx].index.get_level_values('SHORT_TECH')\
            [invest_dfs[idx].index.get_level_values('YEAR') ==  i],
            y=invest_dfs[idx].VALUE.loc[invest_dfs[idx].index.get_level_values('YEAR') ==  i])\
            for i in invest_dfs[idx].index.get_level_values('YEAR').unique()
    fig = go.Figure(data=data)
    # Change the bar mode
LOCS = widgets.Dropdown(options=list(locations),value='Rotterdam', description='locations')

the error is:

ValueError: cannot find widget or abbreviation for argument: 'locations'

I am running it on jupyter notebook