Manipulating sys.path in the Notebook§

You can add your module’s sub-directory to Pythons path like this:

[1]:
import os
import sys
sys.path.insert(0, os.path.abspath('../module-subdirectory'))

… then you can simply import it:

[2]:
import mymodule
[3]:
mymodule.hello()
Hello, world!

Of course it is quite ugly to show this path manipulation in each notebook. You can also move this to a helper module, see this notebook.