I have a directory structure that looks like this:
Project
|+-- test.py
|
+>> agents
| +-- __init__.py
| +-- TestAgent.py
|
+>> automation
| +-- __init__.py
| |
| +>> navigators
| +--__init__.py
| +--SystemNavigator.py
Inside _ _ init _ _.py under agents I have the following code:
from TestAgent import TestAgent
And inside SystemNavigator I have:
from agents import TestAgent
When I attempt to run the program, I get:
Traceback (most recent call last):
File "test.py", line 1, in <module>
from navigators import SystemNavigator
File "/Users/jb/Desktop/code/tools/pythontest/automation/navigators/__init__.py", line 1, in <module>
from SystemNavigator import SystemNavigator
File "/Users/jb/Desktop/code/tools/pythontest/automation/navigators/SystemNavigator.py", line 1, in <module>
from agents import TestAgent
ImportError: No module named agents
I setup an identical file structure in a separate directory to double check, and I was able to get this working there. I read around Stack Overflow and elsewhere. I'd like to avoid any changes to sys.path or changes to my directory structure. Based on others suggestions, I tried deleting .pyc files within the directory and also deleting / recreating the _ _ init _ _.py under agents.
Does anyone have advice on where I should look next to troubleshoot? I'd really appreciate it!