Let's imagine i have class
class NewSettingsAdded: # type: NewSettingsAdded
def __init__(self, system: str, org_id: ):
self.system = system
self.org_id = org_id
def find_head_organization(self):
"do some prepare"
def process(self):
" process"
I would like to after instance initialization automatiucally call only find_head_organization for self. I tried to do something like
class OrganisationCaller(type):
def __call__(cls, *args, **kwargs):
obj = type.__call__(cls, *args, **kwargs)
obj.new_init()
return obj
class NewSettingsAdded: # type: NewSettingsAdded
def __init__(self, system: str, org_id: int,):
__metaclass__ = OrganisationCaller
self.system = system
self.org_id = org_id
def find_head_organization(self):
"do some prepare"
def process(self):
" process"
But in this approach, it calls all methods after initialisation
find_head_organizationat the end of__init__inNewSettingsAdded?__init__that calls some other function, but again, why?