Currently my configuration options (constants / variables) are a bit fragmented, I have most of them in config.py but some are in the myfile.py at the top.
/utilities/myfile.py
/config.py
An example of what you might find in my myfile.py is:
TEMP_DIR = '/tmp'
If I wanted to move this definition from my myfile.py into my config.py but still use it in my myfile.py, how do I go about it?
I am new to python but I assume it is something along the lines of this at the top of myfile.py
from config
variant 1
this polutes the whole namespace in myfile.py
variant 2
Ever value used in myfile.py have to be mentioned.
variant 3
every value need to refer to config.
Your choice, but i prefer variant 3. To see config.py in myfile.py, you either have to edit your PYTHONPATH or use a relative import: