-
-
Notifications
You must be signed in to change notification settings - Fork 84
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to run transition #373
Comments
Hi @galhyt , it should work the same. The main difference is that I've made explicit the difference between Taking your example: transition = source.to(target)
If your system is more event-oriented, you can use the sm.send("transition") Or if you want to call the event in an imperative-style programming, you can still call the event as a method: sm.transition() Please see https://python-statemachine.readthedocs.io/en/latest/transitions.html for a more complete explanation. Best regards! |
Hi @fgmacedo, But does it calling on_transition (on_event) function as it used to in 0.9.0? |
Yes. Are you getting an error? Or an action not being called? |
The function on_transition is not being called |
Can you please copy-paste or write a complete example that reproduces the error that I can run locally? We have automated tests to test this callback, so maybe is something easy like a typo that a fresh look on the code can spot. |
Ok I will, |
Ok, I managed with this problem. |
Nice! Closing the issue. Feel free to reach out any time. Best! |
Description
How do I run transition? in version 0.9.0 I would run it like this:
source = State(...)
target = State(...)
transition = source.to(target)
sm.(...)
def on_(**kwargs):
if can't move to target:
raise
How can I do it in version 2?
What I Did
The text was updated successfully, but these errors were encountered: