How to update the original CDS in Jupyter Notebook Bokeh?

Hello,

I’m creating a toy app in jupyter notebook where I’d like to add some points in a scatter plot and then keep working with an updated version of the data. I tried to access to the source but is not updated. Is this possible in Jupyter Notebook or is required a bokeh app? Thanks in advance!

    from bokeh.sampledata.iris import flowers
    from bokeh.plotting import figure, output_file, show
    from bokeh.io import output_notebook
    from bokeh.models.widgets import Button
    output_notebook()

    from bokeh.plotting import ColumnDataSource, figure, output_file, show, Column
    from bokeh.models import Plot, Range1d, MultiLine, Circle, HoverTool, BoxZoomTool, ResetTool, PointDrawTool, TableColumn, DataTable, CustomJS

    import pandas as pd
    d = dict(
        x=[1, 2, 3, 4, 5],
        y=[2, 5, 8, 2, 7],
        desc=['A', 'b', 'C', 'd', 'E'],
        imgs = [my_base64_jpgData,my_base64_jpgData,my_base64_jpgData,my_base64_jpgData,my_base64_jpgData],
        fonts=[
            '<i>italics</i>',
            '<pre>pre</pre>',
            '<b>bold</b>',
            '<small>small</small>',
            '<del>del</del>'
        ])
        
    data = pd.DataFrame(d)


    source = ColumnDataSource(data=data)

    p = figure(plot_width=400, plot_height=400,
               title="Mouse over the dots")

    a = p.circle('x', 'y', size=20, source=source)

    columns = [TableColumn(field="x", title="x"),
               TableColumn(field="y", title="y"),
               TableColumn(field='desc', title='desc')]

    table = DataTable(source=source, columns=columns, editable=True, height=200)
        
    p.add_tools( BoxZoomTool(), ResetTool(), PointDrawTool(renderers=[a]))

    show(Column(p,table), notebook_handle=False)

push_notebook only functions in one direction: you can push updates from Python, to JavaScript. If you need to do the converse, e.g. update a Python CDS based on some JS event, then that needs a Bokeh server app, which can also be embedded in notebooks:

bokeh/notebook_embed.ipynb at branch-3.0 · bokeh/bokeh · GitHub