Python searches for Variables not only in local or global scoop but also in __builtins__. If you do something like __builtins__.os = os, than this variable should be accessible global.
If you then write something like: def B(): os.stat("/") import os Python recognises on compile time, that os is a local variable in B and allocates memory for it. All reading or writing now goes to the local variable and not the one in __builtins__. And the local variable has never been assigned to a value and an Exception is thrown. Best -- http://mail.python.org/mailman/listinfo/python-list