Galera was studying python and saw on a website this line:
self.brotcl.plugins.runCustumcomand()
I know that self is referencing a class but and these three variables together like that?
Galera was studying python and saw on a website this line:
self.brotcl.plugins.runCustumcomand()
I know that self is referencing a class but and these three variables together like that?
self
is referencing the object itself that has an attribute called brotctl
.
self.brotctl
is an object that has the plugins
attribute.
Likewise, self.brotctl.plugins
is an object that has method runCustomcomand
.
An example implementation for what you present would be:
class Plugins:
def runCustomcomand(self):
pass
class Brotctl:
def __init__(self):
self.plugins = Plugins()
class Exemplo:
def __init__(self):
self.broatctl = Broatctl()
def run(self):
self.broatctl.plugins.runCustomcomand()