2

I am trying to get a simple (temporary) way of sharing some settings between several python modules working. Currently I am experimenting with the following code:

A.py:

from B import *
from C import *

if __name__ == '__main__':
    Test()
    dummy = "def"
    print "Second"
    Test()

B.py:

from C import *

def Test():
    print dummy

C.py:

dummy = "abc"

When I run this with 'python A.py' I would expect this to print as its output the following:

abc
Second
def

However, the result I actually get is:

abc
Second
abc

This shows that the assignment to the variable dummy does not show up in the B module. Why is that?

Cœur
  • 37,241
  • 25
  • 195
  • 267
davidv1992
  • 158
  • 10

0 Answers0