fork download
  1. abc = 1
  2.  
  3. def set_global(name, value):
  4. globals()[name] = value
  5.  
  6. if __name__ == "__main__":
  7. set_global("abc", 2)
  8. print("__main__.abc = %s" % abc)
  9.  
  10. import prog
  11. prog.set_global("abc", 3)
  12. print("prog.abc = %s" % prog.abc)
  13. print("__main__.abc = %s" % abc)
  14.  
Success #stdin #stdout 0.08s 10864KB
stdin
Standard input is empty
stdout
__main__.abc = 2
prog.abc     = 3
__main__.abc = 2