So I have 3 files like so:
[source lang="python"]#Test1.pyimport Test2, Test.Test3if __name__ == '__main__': Test2.initVal() print Test2.getVal() Test.Test3.func()[/source]
[source lang="python"]#Test2.pyval = {}def initVal(): val[0] = 1 def getVal(): return val[0][/source]
[source lang="python"]#Test/Test3.pyimport Blobs.Test2def func(): print Blobs.Test2.getVal() #blobs is top level package[/source]
This prints 1, then gives me an exception, because func() sees val as empty the second time. How do I make it see the properly changed variable?
EDIT: clarified behavior
Show differencesHistory of post edits
#2King Mir
Posted 26 June 2012 - 04:24 PM
So I have 3 files like so:
[source lang="python"]#Test1.pyimport Test2, Test.Test3if __name__ == '__main__': Test2.initVal() print Test2.getVal() Test.Test3.func()[/source]
[source lang="python"]#Test2.pyval = {}def initVal(): val[0] = 1 def getVal(): return val[0][/source]
[source lang="python"]#Test/Test3.pyimport Blobs.Test2def func(): print Blobs.Test2.getVal() #blobs is top level package[/source]
This prints 1, then gives me an exception, because func() sees val as empty the second time. How do I make it see the properly changed variable?
EDIT: clarified behavior
[source lang="python"]#Test1.pyimport Test2, Test.Test3if __name__ == '__main__': Test2.initVal() print Test2.getVal() Test.Test3.func()[/source]
[source lang="python"]#Test2.pyval = {}def initVal(): val[0] = 1 def getVal(): return val[0][/source]
[source lang="python"]#Test/Test3.pyimport Blobs.Test2def func(): print Blobs.Test2.getVal() #blobs is top level package[/source]
This prints 1, then gives me an exception, because func() sees val as empty the second time. How do I make it see the properly changed variable?
EDIT: clarified behavior
#1King Mir
Posted 26 June 2012 - 07:14 AM
So I have 3 files like so:
[source lang="python"]#Test1.pyimport Test2, Test.Test3if __name__ == '__main__': Test2.initVal() print Test2.getVal() Test.Test3.func()[/source]
[source lang="python"]#Test2.pyval = {}def initVal(): val[0] = 1 def getVal(): return val[0][/source]
[source lang="python"]#Test/Test3.pyimport Blobs.Test2def func(): print Blobs.Test2.getVal() #blobs is top level package[/source]
This gives me an exception, because func() sees val as empty. How do I make it see the properly changed variable?
[source lang="python"]#Test1.pyimport Test2, Test.Test3if __name__ == '__main__': Test2.initVal() print Test2.getVal() Test.Test3.func()[/source]
[source lang="python"]#Test2.pyval = {}def initVal(): val[0] = 1 def getVal(): return val[0][/source]
[source lang="python"]#Test/Test3.pyimport Blobs.Test2def func(): print Blobs.Test2.getVal() #blobs is top level package[/source]
This gives me an exception, because func() sees val as empty. How do I make it see the properly changed variable?