user1060517 user1060517 - 25 days ago 17
Python Question

Python - import fails to load a module

I have a python file abc.py which was part of a repo (say repo-old). This abc.py was imported by xyz.py (which is also part of repo-old).

Now due to some reason abc.py is removed from repo-old, but I need to test code in repo-old, so I manually copied it back.

Now when the import statement in xyz.py is hit, it fails, saying "not found".

What could I be missing?

P.S - new to python packaging.

Answer

Did you make sure that the folder that contains the file you are trying to import has an __init__.py file?

Comments