Writing python code which takes values from other python code

Hello python fellows,
I have a original code which can have a name original.py
In this code lines are something like this:

from name.table import Work

wall.mathematics.equation.x = 0.1
wall.mathematics.equation.name = ‘special_method’
wall.mathematics.equation.iterationnumber = 10000
wall.mathematics.equation.formula = ‘linspace(10, 20, 101))’
wall.mathematics.equation.question = True

Now I want to write the final code with name final.py which uses or calls some of these values from this code. I want to take number of iterations (10000) from the line wall.mathematics.equation.iterationnumber = 10000, I want to take string ‘special_method’ from the line wall.mathematics.equation.name = ‘special_method’, I want to take True from the line wall.mathematics.equation.question = True, etc…

Thank you very much for every help.

Best regards,


Assuming that I can import your original.py by the name original,
then something like:

 from original import wall

 # for convenince
 eqn = wall.mathematics.equation

 ... do stuff using eqn.question etc etc ...

Hello Cameron,

Actually, your approach is correct.

Thanks a lot.

Best regards,