Reputation: 9844
I'm trying to import a class (that is inside an specific folder) into another class inside my package, but I got:
No module named Folder'X'
This is the structure of my project:
-project
|-Sources
|-Folder1
|- class1.py
|- class2.py
|-Folder2
|- class3.py
|- class4.py
|-__init__.py
An this is how I'm doing so far:
--> In class1.py:
import Sources.Folder2.class3
class class1(object):
...
--> In __init__.py:
import Sources.Folder1.class1
if __name__ == '__main__':
...
Any help would be appreciated. I found similar questions but I couldn't solve my problem.
Upvotes: 0
Views: 84
Reputation: 180
I guess that it comes from the fact that you need at least an empty init.py file in all of your sub-directories.
Upvotes: 1