Activate a code cell programmatically from extension

I am adding some piece of code to a new code cell from my extension. Now, after I add the code cell, I would like to activate the cell from my extension. I couldn’t find any relevant method to do this in the NoteBookTracker or NotebookActions class, can someone help me with this issue?

Thanks,
Rakesh.

Setting Notebook.activeCellIndex is the most predictable way to do this.

Depending on what you already know about the cell, you might have to go looking through the model, or even the DOM, as needed here when finding a specific anchored element.

1 Like