'How to get the connection information about the running jupyter notebook editor of vscode from another extension?

I'm currently developing a vscode extension that is activated when a notebook editor is open. The extension needs to get some connection information about the notebook so that I could use the jupyter_client module. Is there any APIs that could be useful? For example, is it possible that the extension creates a notebook cell with "%connect_info" magic command and accesses the cell's output to get some information about the running notebook?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source