How I do it?

I wanna execute some code when a module is imported:

-- foo.py --
#!/usr/bin/env python

def codetoexecwhenloaded():
        print "bar"
-- end of foo.py --

-- in console --

import foo

^ and then it should print "bar"

Thanks, Arthas
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to