Linked Questions

Popular Questions

I have a Python project with multiple .py files. One file should be the "control" file, where parameters can be altered. Other files should receive input from this control file, and return varying outputs.

My code does as expected if I am using a fresh kernel (I am using Spyder in Anaconda), but after one run if I change a parameter in the control file, not all subsequent variables are updated.

I have searched stackoverflow and google but am struggling to find the "right way" to accomplish this. In the real case there are many more files with many more interdependencies, but I have boiled the problem down to the following simple example.

For example,

var = 42

import as con
var2 = con.var

Running the first time prints 42, as expected. But if within I change to var = 43, save, and then run again, I receive 42

I want to give 43 in this instance.

Related Questions