added state machine for python scripts