Q:

MODIFYING VARIABLES IN ANOTHER SCRIPT : PYTHON

I am new to python.
I have 3 python files(modules) A,B and C.
A is the main module.
B is a module which has some variables and arrays declared and initialized using the numpy module.All the variables are declared as global.
C is a module that is supposed to write the data into the declared variables in B.
So i am trying this :
Run module A.
Import * all the variables from B into A.
Declare global variables in C and write the data to them.
But it does not work.When i try to print out an array from A it just prints the initialized array and not the modified one.
Any idea as to how to correctly get this to work.
The help is much appreciated.

A:

Python is intentionally making things like this very difficult. When you do this, you are very likely to make mistakes and things will go wrong. And when they go wrong it will be really difficult to find out where the mistake was.
Generally speaking, module A can read variables from module B, but cannot write to them. When you attempt to write to the variable, a new variable will be created with the same name instead. This is very confusing and should of course be avoided if you want to remain sane :)
If you want to pass data from one module/file/script/whatever to another, you generally wrap everything in functions. You can keep B as it is, with global (read-only) variables containing the defaults. Make C a collection of functions that take the data as parameters and return the result. From A, first read in the variables from B like you do now, then start calling functions in C, passing the relevant data as parameter and storing the result in a new variable.

