On Mar 8, 9:09 pm, "rh0dium" <[EMAIL PROTECTED]> wrote:
[snip]
> for mod in listdir():
>    __import__(mod)
>    a=mod()
>    a.dosomething()  # This is a function which each class shares.
>
> Can anyone help?

You are not using __import__ correctly.  Perhaps reading the doc would
be a good start:
http://docs.python.org/lib/built-in-funcs.html

For example to import the module defined in 'foo.py' you would do
foo = __import__('foo')
Then your class foo would be accessible as foo.foo

HTH

--
Arnaud

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to