Python - Import from parent directory - GeeksforGeeks
30.05.2021 · Now let’s learn how to import a module from the parent directory: In order to import a module, the directory having that module must be present on PYTHONPATH. It is an environment variable that contains the list of packages …
python - Import Script from a Parent Directory - Stack Overflow
stackoverflow.com › questions › 8951255Jan 21, 2012 · There are cases where changing sys.path could be useful e.g., if python itself'd done it or a 3-party module that handles all corner cases correctly done it e.g., import autopath; autopath.add_toplevel_to_syspath() that automatically adds parent directory of toplevel_package to sys.path to allow a direct internal module execution as a script (or in a REPL) from any directory without proper PYTHONPATH or (virtualenv) install.