I am going to try to be clear. I have a ex.py file I want to import in other py files. In the ex.py file there is a variable that I declare. However, I would like to declare that variable in the other py files.
I have a file ex.py:
variable = 5
whatever = 10 + variable
For example in an other .py file, I would have:
from ex import whatever
variable = 10
print(whatever) # whatever object uses the variable
The result from printing whatever will be 15. I would like to have 20 as i declare variable in the new script.
That is to streamline the code so that the same .py file can be used in several other files.
Any contribution please.
ex.pyand what is the expected output ofprint(whatever)?