0

I have the following hierarchy of folders and files:

top_level
   scripts
      s1.py
   notebooks
      nb1.ipynb

I need to import the functions of s1.py into nb1.ipynb. I already tried different methods but nothing worked. Please notice that I do not want to use sys.path.

This is what I tried last:

from .. import scripts/s1
Tatik
  • 1,107
  • 1
  • 9
  • 17

1 Answers1

0

Have you tried this answer?

Possible example:

from top_level.scripts.s1 import func_name
Ishmael
  • 235
  • 3
  • 8
  • 17
  • Yes, I tried it. There should be a dot before `top_level`. Anyway it fails with the error `ModuleNotFoundError: No module named '__main__.top_level'; '__main__' is not a package` – Tatik May 19 '19 at 16:38