I am trying to run a notebook from another notebook using the dbutils.notebook.run as follows:
import ipywidgets as widgets
from ipywidgets import interact
from ipywidgets import Box
button = widgets.Button(description='Run model')
out = widgets.Output()
def on_button_clicked(b):
button.description = 'Run model'
with out:
dbutils.notebook.run("/mynotebookpath",60)
button.on_click(on_button_clicked)
widgets.VBox([button, out])
However, I am getting the following error:
IllegalArgumentException: Context not valid. If you are calling this outside the main thread, you must set the Notebook context via dbutils.notebook.setContext(ctx), where ctx is a value retrieved from the main thread (and the same cell)
I can run the notebook just fine when I do %run
on a single cell and even dbutils.notebook.run("/mynotebook", 60)
on a single cell. However I cannot get it to run within the ipywidget context