import sys import pathlib file = pathlib.Path(__file__) directory = file.parent import_root = directory.parent sys.path.append(str(import_root))