Very Newbie - Python classes across modules
Can anyone tell me how to get say module 'a' to recognize the classe(s) in module 'b'? I can instantiate a class in module 'b' but I can not figure out how to have module 'a' recognize it.
Having to use 'global' would be a pain and I don't even know if it would work.
In addition, I can not figure out how or even if it is possible to instantiate a class from module 'b' inside of module 'a'.
I am trying to convert a program that has a ton of separate files to Python and putting everything in one file is just not practical.
I'm sure it must be a simple thing but, so far, it's too much for me apparently.
I know this is a silly question but try not to abuse me too much.
in module b:
from a import YourKlass #get YourKlass from module a
yk = YourKlass() #instantiate that class
import a #get module 'a'
yk = a.YourKlass() #instantiate YourKlass in module a
global wouldn't work anyway.
Originally Posted by catlover
July 10th, 2005, 05:06 AM
the way I understood the question is how to recognize a class remotly and as far as I know you can't do that...
Those people who think they know everything are a great annoyance to those of us who do.
July 10th, 2005, 12:13 PM
Thank you very much for taking the time to help.