import a from b import bar note = """ a and b are very similar and look like this: # this is module a.py def foo(): global globaldict globaldict = {} globaldict["A"] = True """ def baz(): global globaldict globaldict = {} globaldict["C"] = True a.foo() try: print globaldict except: print "NO GLOBAL DICT AFTER a.foo()" bar() try: print globaldict except: print "NO GLOBAL DICT AFTER b.bar()" baz() try: print globaldict except: print "NO GLOBAL DICT AFTER baz()" output = """ NO GLOBAL DICT AFTER a.foo() NO GLOBAL DICT AFTER b.bar() {'C': True} """