Reputation: 63
Say I have the following structure:
main.py
.folder/
a.py
b.py
and using Python 3 and being currently in main.py
I want to import *
from a.py
.
from .folder.a import *
is wrong as that ignores that the folder is actually named .folder
, not folder
from ..folder.a import *
is wrong as I'm not targeting a relative parent directory called folder
, but a folder named .folder
within the same directory as main.py
Upvotes: 6
Views: 2997
Reputation: 600041
You can't do this; names of packages and modules need to be valid Python identifiers, which .folder
is not. You should rename your directory.
Upvotes: 13