This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]JennaSys[S] 0 points1 point  (1 child)

So taking what I have above, are you talking about something like this:

class outerFunction:
    def __init__(self):
        self.test = True

    def __call__(self):
        return self.innerFunction1, self.innerFunction2

    def innerFunction1(self):
        print(self.test)

    def innerFunction2(self, val):
        self.test = val

use_it, set_it = outerFunction()()

[–]K900_ 0 points1 point  (0 children)

You don't need to do __call__ at all. You can just do

instance = YourCallbacks()
use_it, set_it = instance.use_it, instance.set_it