Hello. How would you call a class method from a trigger?
The code above will yield an error "procedure not found". I can register my method in globals...
...and it will work, but that's just unacceptable. Any way to solve this? Thank you.
class MyClass:
def __init__(self):
pass
def trigger_procedure(self, name, line, wildcards):
world.Note('Trigger fired.')
obj = MyClass()
<triggers>
<trigger
enabled="y"
match="^$"
regexp="y"
script="obj.trigger_procedure"
sequence="100"
>
</trigger>
</triggers>
The code above will yield an error "procedure not found". I can register my method in globals...
globals()['obj.trigger_procedure'] = obj.trigger_procedure
...and it will work, but that's just unacceptable. Any way to solve this? Thank you.