I am interacting with a python 2.x API written in a non-OO way, it uses module-global scope for some internal state driven stuff. It\'s needed in a context where it\'s no longer
Just remove the module from sys.modules:
>>> import sys >>> import mod as m1 >>> m1.x = 1 >>> del sys.modules['mod'] >>> import mod as m2 >>> m2.x = 2 >>> m1.x 1