rh0dium wrote:
> foo.py
>
> class foo:
>def __init__(self):
> print "Hi I am %s" % self.__class__.__name__
I wrote this in a file here...
> Now I have a bunch of these files. I want to be able to dynamically
> import each one and run it. I am having a problem actually doing the
> wo
Arnaud Delobelle wrote:
> 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. Perhap
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: