Jupyter equivalent of sys.path[0] (how to get the directory of the notebook file)

In Jupyter,

import sys
sys.path[0]

will not return the directory where the notebook file resides but something like

/usr/lib/python310.zip

Instead, use

import os.path

os.path.dirname(os.path.realpath("__file__"))