Unless you override some of os.* functions in foo, you want to import os into foo and bar separately. Python does not reimport the module a second time (create a second instance of os), it only creates a pointer to the first instance that's loaded.