Communication between a JS page and a Bokeh plot

Some updates from my side.

Related to 2), I have understood that flask can communicate with a boken server both ways by sharing the session.document object. I am trying to implement a simple example, however, I am stuck with some unexpected behavior. I have opened a separate thread Read and modify a bokeh slider value from flask

As I mentioned, I also was able to get arguments from flask form URL of the bokeh server, using

# request.arguments is a dict that maps argument names to lists of strings,
# e.g, the query string ?N=10 will result in {'N': [b'10']}

args = curdoc().session_context.request.arguments

try:
  N = int(args.get('N')[0])
except:
  N = 200

However this works only once the plot is generated the first time and does not allow to be interactive.

Do you see other best practices related to 2) that I am not aware of?

Related to 1) my understanding is that js_on_event() can work only if the injected js code lives in the same JS page which include the plots, which may not be the case. In my setting, I am interested in having the plot in a React page.

best,
Luigi