constants.py
import os
from datetime import date
dates = datetime.datetime.now().strftime("mon_%m_day_%d_%H_%M")
out_dir = 'C:\\'+'_'+dates+os.sep
file_a.py
from constants import *
# Use out_dir
file_b.py
from constants import *
# Use out_dir
In the above code, I create a directory with the current date and time embedded in the name. Then I import that file in 2 separate .py files. However, I find that the out_dir changes in file_b.py as the date has changed. any ideas on how to fix this?
Alternatively, is there a way to find out when out_dir is changing?