How to get the list of imported variables/functions

Michael Hudson mwh21 at
Wed May 3 06:07:58 EDT 2000

"Emile van Sebille" <emile at> writes:

> Well, I got this to work:
> a = dir(sys.modules['imported_mod'])
> then filter as needed.
> I couldn't get the keys attribute of the module though. Should
> I have been able to?
> filter(lambda s:s[1]<>'_',sys.module['imported_mod'].__dict__.keys())

Ack, surse me for a fool; I meant

filter(lambda s:s[1]<>'_',sys.modules['imported_mod'].__dict__.keys())

(I've even tested it this time!)


8. A programming language is low level when its programs require
   attention to the irrelevant.
     -- Alan Perlis,

More information about the Python-list mailing list