I am using Fysom to create FSM. I want to use callbacks in an other way:
TABLE = {
'initial': 'OFF',
'events': [{'name': 'load', 'src': 'OFF', 'dst': 'LOADED'},],
'callbacks': {'onload': myfunction,}}
fsm = Fysom(TABLE)
Here if I launch fsm.onload()
it will execute myfunction
. Instead I want If I launch myfunction()
it will lunch fsm.onload()
.
I took a look on the script and related part is here:
def _enter_state(self, e):
'''
Executes the callback for onenter_state_ or on_state_.
'''
for fnname in ['onenter' + e.dst, 'on' + e.dst]:
if hasattr(self, fnname):
return getattr(self, fnname)(e)
I don't see how to change this peace of code for my purpose.