I have a Jupyter script similar to the following: import ipywidgets import IPython.display import functools def _handler(text: ipywidgets.Text, button: ipywidgets.Button) -> None: label = ipywidgets.Label(f"Doing stuff with input '{text.value}'.") IPython.display.display(label) # Do a bunch more stuff, including drawing new UI elements. prompt = ipywidgets.Text(description="Input: ") button = ipywidgets.Button(description="Run") button.on_click(functools.partial(_handler, prompt)) prompt_box = ipywidgets.HBox([prompt, button]) IPython.display.display(prompt_box) I prompt the user for some input, then resume execution when the user clicks "Run". The further execution involves reading a bunch of data and drawing various new UI controls (Label, IntProgress, etc.). Eventually, I'll draw some more buttons and ask the user to select an operation to perform on the data. However, rather than drawing my Label (and all of the other stuff that I omitted from this simplified case), Jupyter just writes them to the log: 12:00:00 AM Label(value="Doing stuff with input 'asdf'.") What's going on here? Google's search AI hinted that there are ways that I could have messed up Jupyter's UI framework but didn't give me any further information, and all of the search results that I found seemed to be solved by writing to an Output that was defined outside of the click handler -- but since I need to do more than just display text here, that is not a solution. Unless Jupyter doesn't allow UI elements to be drawn from within event handlers, I don't see how I could have broken its UI framework here, and if that is the case, I'm at a loss as to how I can return to a context where I can draw UI elements again. Continue reading...