Python absolute Imports are not resolved as intended
I work with a large repository (https://github.com/jenellefeather/model_metamers_pytorch). This repository has many packages. All imports are absolute. To run the code the repository says to copy a certain file into a subsubsubdirectory and run it there. But when I enter this subsubsubdirectory and run the code the imports fail.
Import creates unexpected references to objects depending on whether a module is a file, or when it is part of a package
I have subtle import issue that creates variables with references to objects different to what I expect, and it all depends on whether the module I’m writing is imported “as is” or as part of a package.
Why Does this Failed Import Cause Future Imports to Also Fail (which otherwise wouldn’t)?
This question is really just about the “why.” I’m not actually interested in a work-around. I just want to understand why this doesn’t work as is. Basically, I have a tiny python repo https://github.com/ThomasLastName/bnns in which I have a script with a try/except block: