Suppose in main.py
I have
from tools import myconstant
and in tools.py
I have:
myconstant = 15
Now I add something to tools.py
:
myconstant = 15
myotherconstant = 25
Save the file and in main.py
I run (still from the same python session):
from tools import myotherconstant
which throws an error. If I restart my python session it works. Why is that? I know that usually, one would run the main file from a fresh session and never have this 'problem' but I am still curious as to why python cannot detect changes in files. If I change the contents of a CSV file and read it in again it would reflect the updated data. What is the difference here?
There is no problem to solve here, I am just asking for clarification of python concepts :) Some minimal examples that demonstrate the inner workings would be appreciated.