How to create a jupyter-lab extension that interacts with a running kernel

I have also created this as a question on stackoverflow but figured this may be a better place to ask.

I am trying to create an extension for jupyter-lab that interacts with a running ipython kernel, running either in a console or a notebook.

As a minimal example I am trying to get two “hello world” type programs. The first should print a message to stdout of the running kernel that is input in the extension. The second should log a message to the console of the extension that is input in the running ipython kernel.

To understand jupyter-lab extension I started with the astronomy picture of the day tutorial. Although this covers the basics of extensions this does not address interacting with a running kernel.

From “really confused with jupyter notebook lab extensions and ipywidgets”! it seems I should be looking at the Comms module however this is documentation for Jupyter-notebook and not for Jupyter-lab . As far as I understand, Jupyter-lab is sufficiently different under the hood that this should not work.

Could someone explain to me how to create an extension that interacts with a running kernel and what the appropriate documentation/tutorial is to look at if it exists?

1 Like