This is a follow up to "How to import a Python class that is in a directory above?", which gives how to import a file from the parent directory:
from .. import module
I to get a specific function from a file in the directory above.
This is my attempt: There is a file in the higher directory called topLevel.py
which has a function called test_function
.
from .. import topLevel
from topLevel import test_function
This is the error message:
ValueError: attempted relative import beyond top-level package