# In a jupyter notebook, is there anyway to go to the top cell where all the import statements are and then return back to current working cell, using keyboard?

**URL:** <https://discourse.jupyter.org/t/in-a-jupyter-notebook-is-there-anyway-to-go-to-the-top-cell-where-all-the-import-statements-are-and-then-return-back-to-current-working-cell-using-keyboard/12363>\
**Category:** ipynb\
**Created:** [December 28, 2021, 4:49pm UTC](https://discourse.jupyter.org/t/in-a-jupyter-notebook-is-there-anyway-to-go-to-the-top-cell-where-all-the-import-statements-are-and-then-return-back-to-current-working-cell-using-keyboard/12363 "2021-12-28T16:49:26Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![randhar](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.jupyter.org/randhar/32/3221_2.png) [@randhar](https://discourse.jupyter.org/u/randhar)\
**Post date:** [December 28, 2021, 4:49pm UTC](https://discourse.jupyter.org/t/in-a-jupyter-notebook-is-there-anyway-to-go-to-the-top-cell-where-all-the-import-statements-are-and-then-return-back-to-current-working-cell-using-keyboard/12363/1 "2021-12-28T16:49:26Z")

</div>

During writing the code, while I am in the middle part of the notebook I always want to include some import statements but for that I always have to scroll up to the top cell write the import statement and scroll back down to the previous working cell and continue from there. Is there a keyboard shortcut for this?

---

<div class="post-metadata">

**Author:** ![fomightez](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.jupyter.org/fomightez/32/495_2.png) [@fomightez](https://discourse.jupyter.org/u/fomightez)\
**Post date:** [December 28, 2021, 7:05pm UTC](https://discourse.jupyter.org/t/in-a-jupyter-notebook-is-there-anyway-to-go-to-the-top-cell-where-all-the-import-statements-are-and-then-return-back-to-current-working-cell-using-keyboard/12363/2 "2021-12-28T19:05:32Z")

</div>

Are you sure you are using the classic notebook interface as your topic tags indicate?  
JupyterLab lets you open two views of the notebook side-by-side (or even above and below if you prefer) so that you can edit different parts in the two views. See [here](https://youtu.be/SQn9aRc050w) as detailed under '‘Create multiple synchronized views of a single notebook’ in [JupyterLab’s Notebooks documentation](https://jupyterlab.readthedocs.io/en/stable/user/notebook.html#notebooks).  
It’s abilities like these that make JupyterLab the **current** generation interface.

---

<div class="post-metadata">

**Author:** ![naibed](https://avatars.discourse-cdn.com/v4/letter/n/51bf81/32.png) [@naibed](https://discourse.jupyter.org/u/naibed)\
**Post date:** [February 20, 2025, 7:32pm UTC](https://discourse.jupyter.org/t/in-a-jupyter-notebook-is-there-anyway-to-go-to-the-top-cell-where-all-the-import-statements-are-and-then-return-back-to-current-working-cell-using-keyboard/12363/3 "2025-02-20T19:32:20Z")

</div>

I did come across a related ticket (from ~ 10 months ago though). It was approved, so just gotta wait for it to be prioritized from the sound of things:

> <https://github.com/jupyter/notebook/issues/7340>
>
> \### Problem
> 
> Could there be a keyboard shortcut to jump to the first/last cell…?
> 
> I want to do this all the time (e.g. I am writing code in the last cell that I want to test, but I have all my imports in the first cell; I restart the kernel and have to scroll all the way to the top to run the first cell then all the way back to the bottom to run the last cell). I couldn't see a way of doing this currently, nor that anyone else had requested it. 
> 
> Note that the current functionality of Home is not what I'm looking for - that shows you the first cell but the previously selected cell remains selected. You need to press Home and then reach for the mouse to click into the cell which is really annoying. 
> 
> 
> 
> \### Proposed Solution
> 
> A simple keyboard shortcut (e.g. Shift+Home/End) in escape mode to jump to the first/last cell. The first/last cell would then be selected (in escape mode).
> 
> 
> 
> \### Additional context
> 
> I can't quite understand why this isn't already an option! It makes it almost impossible to use Jupyter notebook using just the keyboard which is what many users like to do!
