from os.path import exists
from tfw.fsm import LinearFSM
from tfw.networking import MessageSender

class TestFSM(LinearFSM):
    def __init__(self):
        super().__init__(2)
        self.subscribe_predicate('step_1', self.step_1_allowed)

    @staticmethod
    def step_1_allowed():
        return exists('allow_step_1')

    def on_enter_1(self, event_data):
        MessageSender().message_sender.send('FSM', 'Entered state 1!')

