Skip to content

Force transition to initial state #494

@Jakuko99

Description

@Jakuko99
  • Python State Machine version: 2.3.6
  • Python version: 3.10.4
  • Operating System: Windows 10

Description

Is there a possiblity to force statemachine to transition from any state to initial state? I know that it could be possible to define these transitions in statemachine, but in my case that would require around 19 transitions and this would make it even more complex than it already is.

My initial state is called "STA" and from there it goes to "idle" and other states. For example I wanted to try to transition from idle back to STA, using self.send("STA"), but this raised an error Can't STA when in Idle. I there a way to force this transition or do I need to define each transition from every state to initial one by hand?

(I can't publish the entire statemachine or the underlying code as this project is made for a company and its purpose is to simulate one of their products)

What I Did

self.send("STA") # send statemachine to initial state

"""Exception has occurred: TransitionNotAllowed
Can't STA when in Idle."""

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions