I am trying to create a widget button that will collect the values of other widgets and then use %run to execute another notebook with those values. I am using %store to pass the values but it does not recognize the python variable with the value to pass and gives an error.
import ipywidgets as widgets
from IPython import get_ipython
ipython = get_ipython()
def on_button_clicked(_):
path=srch_loc.value
with out:
path= srch_loc.value #returns the value typed into widget srch_loc
print('Something happens!')
print(path)
ipython.magic("store path")
button.on_click(on_button_clicked)
When I click the button these are the results:
Something happens!
/san-data/users/$USER/
UsageError: Unknown variable 'path'
The print function recognizes path as a variable but the next line of code doesnt
I expect to not get an unknown variable message and if I run %store to see path listed with the correct value from srch_loc.value