Jupyter Lab extensions python-javascript communication

Hi everyone :wave:

I am building a Jupyter Lab extension that adds extra commands to the main menu. The extension is supposed to create a popup prompt for the user to enter a value which is then passed as a variable in a javascript function. I am using a js library that also has a python version which I have found to be much easier to work with, so I was wondering whether it’s possible to pass the user variable from the extension code to a python script that would then be executed instead of the js one.

I haven’t yet found many resources that deal with this kind of python-javascript communication apart from ipylab but that deals with the python → javascript execution whereas in this case the execution is the other way around.

I appreciate any suggestions!

1 Like

A JupyterLab extension with a server extension component might be what you are looking for. extension-examples/server-extension at master · jupyterlab/extension-examples · GitHub