Jupyter Lab Extension: Is it possible to create a new tab from another tab in my extension?

121 Views Asked by At

I am building a jupyter lab extension. I have managed to create an extension which opens a tab from the launcer. From this tab, I want a user to be able to click on a feature and be navigated to a new tab. Is this possible? I am new to jupyter lab extensions

I am exploring widgets

1

There are 1 best solutions below

0
On

I'm not sure if you can use the ILabShell interface from a widget, but you can use the DocumentManager interface. The openOrReveal method should do what you want.

The following should work:

from jupyterlab.services import DocumentManager
from jupyterlab.commands import CommandRegistry

# Create a document manager and a command registry
manager = DocumentManager()
registry = CommandRegistry()

# Open a new tab
manager.openOrReveal('Untitled.ipynb', registry)