May-24-2023, 02:28 PM
(May-24-2023, 06:11 AM)Gribouillis Wrote:(May-24-2023, 01:10 AM)MeghansUncle2 Wrote: I know it sounds confusing so I'll try to illustrate the questionPlease post a complete example. As it is, the code is not understandable, for example
self.myobj = myclass self.myobj(parameters)cannot run becausemyclass
has not been previously defined andparameters
has not been defined, and alsoself
has not been defined. Try to write code that we can run.
This is not actual code. It is an abstract form of code to illustrate my question.
The question is, can i use an object created within another object outside of that other object. in my example, can i access object "B" outside of object "A"
Main Code
Self.A = Aclass Self.A .somemethod ...A class
class Aclass(object): def somemethod() self.B = BclassI know I left out a lot and this code will not stand on its own. I am asking is there a way to reference the B object from the main code (outside of the A object)?