re: usage of __import__ across two files

2004-12-13 Thread bwobbones
Thanks Diez, Obvious when you put it that way... -- http://mail.python.org/mailman/listinfo/python-list

re: usage of __import__ across two files

2004-12-13 Thread Diez B. Roggisch
> tb = __import__('BMTest2') This yields the _module_ BMTest2 in the variable tb. Now in that module there is a class BMToolbar that defines PrintHello - so this should work: tb.BMToolBar(self).PrintHello() It worked with your commented lines because you did from BMTest2 import BMToolba

re: usage of __import__ across two files

2004-12-12 Thread bwobbones
Oops, Thanks for the reply, but lets try again - I was in a real rush last night...and I obviously posted the wrong code. I'm trying to use the __import__ form of import because I want to dynamically load classes from their .py files. When I run the BMTest.py file, I get the error: File "C:\

Re: usage of __import__ across two files

2004-12-12 Thread Fredrik Lundh
"bwobbones" wrote: > I'm having trouble making __import__ work with the two classes attached. The > PrintHello() method > can't be seen in the BMTest2 class - what am I doing wrong here? in those three lines, most about everything, I'd say ;-) let's see, "PrintHello" is a method of the BMTool

Re: usage of __import__ across two files

2004-12-12 Thread John Roth
"bwobbones" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] Hi, I'm having trouble making __import__ work with the two classes attached. The PrintHello() method can't be seen in the BMTest2 class - what am I doing wrong here? [snip] tb = __import__('BMTest2') tb2.Prin