# Error loading dependencies- Buttons with multiple states

**URL:** <https://community.plotly.com/t/error-loading-dependencies-buttons-with-multiple-states/33998>\
**Category:** plotly.js\
**Created:** [January 22, 2020, 5:34pm UTC](https://community.plotly.com/t/error-loading-dependencies-buttons-with-multiple-states/33998 "2020-01-22T17:34:34Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![fitzman](https://avatars.discourse-cdn.com/v4/letter/f/d78d45/32.png) [@fitzman](https://community.plotly.com/u/fitzman)\
**Post date:** [January 22, 2020, 5:34pm UTC](https://community.plotly.com/t/error-loading-dependencies-buttons-with-multiple-states/33998/1 "2020-01-22T17:34:34Z")

</div>

I’m having trouble with this one callback, which usually returns “Error loading dependencies” despite the function working perfectly when isolated in a separate cell. I am new to Dash, but under the impression that “Error loading dependencies” only came up when the number of inputs/outputs in the callback and the function do not match.

In summary, I want to create a hidden Div that stores an index from a dataframe, then return that row’s other variables later. Any ideas to update this dynamically??

In the DOM:  
html.Div(id=‘sample-index’,  
style={‘display’:‘none’})

In callbacks:

@app.callback([Output(‘sample-index’, ‘children’)],  
[Input(‘generate-button’, ‘n\_clicks’)],  
[State(‘first-dropdown’, ‘value’),  
State(‘SliderA’, ‘value’),  
State(‘second-dropdown’, ‘value’),  
State(‘SliderB’, ‘value’),  
State(‘third-dropdown’, ‘value’),  
State(‘mini-dropdown’, ‘value’)]  
)  
def find\_sample(n\_clicks, feat1, val1, feat2, val2, feat3, val3):  
if n\_clicks is None:  
return “Choose your index”  
#Find 1000 indices closest to specified feature 1 value  
first\_search=df.iloc[(df[feat1]-val1).abs().argsort()[:1000]]  
#Narrow down options to 100 with values closest to 2nd feature value  
second\_search=first\_search.iloc[(first\_search[feat2]-val2).abs().argsort()[:100]].reset\_index()  
#Narrow to options with categorical match  
final=second\_search.loc[second\_search[feat3]==val3][:1]  
#Check whether categorical variable match was found  
if len(final)==1:  
return [final[‘index’]],  
#Else return best combo of first two variables  
else:  
return [second\_search.iloc[0][‘index’]]

---

<div class="post-metadata">

**Author:** ![etienne](https://sea2.discourse-cdn.com/flex024/user_avatar/community.plotly.com/etienne/32/17_2.png) [@etienne](https://community.plotly.com/u/etienne)\
**Post date:** [January 28, 2020, 3:04pm UTC](https://community.plotly.com/t/error-loading-dependencies-buttons-with-multiple-states/33998/2 "2020-01-28T15:04:24Z")

</div>

Someone over in the #dash forum should be able to help you out.
