my structure is like this:
---file1.py
---file2.py
---directory1
---file3.py
---tools
---setting_manager.py
---settings.json
here directory1 and tools are two directories... In setting_manager.py, i have a function that read some settings from settings.json.
with open('settings.json', 'r') as f:
properties = json.load(f)
return properties
And in file1 file2 file3, I import the setting_manager like this:
from tools import setting_manager
but when I need to use this function in file1 file2 and file3. it seems python load funcs directly and can't find my 'settings.json'. For example, when using in file1, i need to set
with open('tools/settings.json', 'r') as f:
then it can work. but in file3 i need to set
with open('../tools/settings.json', 'r') as f:
is there any way to enable my demand?