Thanks, Actually i want to keep a reference from B to all A instantiated like in the case of z
I have class A and i want to call class B via A You can have def x(self, *args, **kwargs): return A(*args, **kwargs) but was wondering if we could keep track while doing it via z = ... Kind Regards, Abdur-Rahmaan Janhangeer compileralchemy <https://compileralchemy.github.io/> | blog <https://abdur-rahmaanj.github.io/> github <https://github.com/Abdur-RahmaanJ> Mauritius On Thu, May 28, 2020 at 12:15 AM Chris Angelico <ros...@gmail.com> wrote: > On Thu, May 28, 2020 at 5:48 AM Abdur-Rahmaan Janhangeer > <arj.pyt...@gmail.com> wrote: > > > > Greetings, > > > > Lets say i have > > > > class A: > > ... > > > > class B: > > self.x = A > > > > then used > > > > b = B() > > z = b.x() > > > > now how in A i get a reference to B when z is assigned to b.x? > > > > Things are very tangled here. What exactly are you doing? Your code is > incomplete at the moment, and I'm not sure what you're trying to > achieve. As it currently stands, class A is completely stand-alone and > will not have any way of knowing about B. > > ChrisA > -- > https://mail.python.org/mailman/listinfo/python-list > -- https://mail.python.org/mailman/listinfo/python-list