I am working on a project that requires a library of dictionaries, as .py files, to be imported into another script 'test_dicts.py' to test them.
When using the code:
from my_repo.config.dictionaries import dictionary1
It will bring in dictionary1, and I can then reference the dict within the py file by doing:
print(dictionary1.dict_name)
However, I will have hundreds of said dictionaries, and it would be useful to import the whole library as one, and reference each by doing:
import my_repo.config.dictionaries as dictsprint(dicts.dictionary1.dict_name)
I have seen this style of import used throughout other similar project, and cannot understand that when I try this, I am prompted with the error:
AttributeError: module 'my_repo.config.dictionaries' has no attribute 'dictionary1'
My working directory is structured as so:
- my_repo - __init__.py - config - __init__.py - dictionaries - __init__.py - dictionary1.py - dictionary2.py - dictionary3.py - tests - __init__.py - test_dicts.py
I have my local repo pip installed with the '-e' editable parameter.