0
class A:

    def Amethod(self, method):

        b = B()
        b.method()

class B:

    def Bmethod(self):

        print('Hello')

I want to be able to call the Amethod method with Bmethod as input: #general idea, but code is of course invalid

a = A()

a.Amethod(Bmethod)

now an issue here is that Bmethod is not recognised as it needs to be invoked on an instance of the B class. However, I can't do this because the B object that I want to invoke Bmethod on does not yet exist.

0 Answers0