tags:

views:

61

answers:

1

Say I am importing the module 'foo' into the module 'bar'. Is it possible for me to change a global variable in foo inside bar?

Let the global variable in foo be 'arbit'. Change arbit so that if bar were to call a function of foo that uses this variable, the updated variable is used rather than the one before that.

+4  A: 

You should be able to do:

import foo
foo.arbit = 'new value'
chrispy
Thanks. This works. Had tried it but there was some other error in the program so thought there might be some catch.
Goutham