I have a problem with class in Python.
I’d like to know how to call an object created in a module in other python program.
Let me show an example. I have these object in “class_module.py” file
def objectCase():
object1 = class_name("object1")
object2 = class_name("object2")
object3 = class_name("object3")
def other_objectCase():
other_object1 = class_name("other_object1")
other_object2 = class_name("other_object2")
other_object3 = class_name("other_object3")
With from class_module.py import *, I think if I use the objectCase() function, I have in my program these object (object1, object2, object3) and, if I use otherobjectCase() function, I call all otherobject.
But this is not true.
What is the problem?
You are creating local variables inside the functions. They are lost as soon as the function returns. If you need these objects later on,
returnthem to the callerand bind names to them in the calling code