Thanks for this question, I just learned something.
So my current understanding is that output_notebook() will embed standalone html/JS and no longer “talk” to the python variables (so in your case input_widget, as an instance of a python class, its value property never gets altered, but its javascript equivalent does)… i.e. there’s no interaction between the python in your notebook and the html embedded in it.
So that got me thinking that there is probably a way to embed bokeh server within a jupyter notebook, which would then actually alter the state of the python stuff.
This example bokeh/notebook_embed.ipynb at branch-3.0 · bokeh/bokeh · GitHub and this doc: Using with Jupyter — Bokeh 2.2.3 Documentation helped me figure this out.
from bokeh.plotting import show, output_notebook, output_file
from bokeh.models import AutocompleteInput,CustomJS
from ipywidgets import interact
output_notebook()
def bkapp(doc):
global input_widget
input_widget = AutocompleteInput(completions=['pok', 'wer', 'foo', 'bar', 'baz'], title='test')
doc.add_root(input_widget)
show(bkapp, notebook_url="http://localhost:8890") #need to update notebook_url arg with your localhost url (mine was 8890)
Now what’s pretty hokey about this is the use of a global variable to hold the input_widget and get it outside the bkapp function. Wondering if there’s a cleaner way… but anyway this actually does work: