Why does rx.call_script require a return statement. #2161
abdullahkhalids
announced in
Q&A
Replies: 1 comment 1 reply
-
To send the event to the client and continue running on the backend, use Since the event has to run in the browser the event handler needs to return or yield the call_script from the backend. If you need the call_script to execute on the frontend immediately, then the event handler must be decorated with |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
In the docs, there is the following example of using
rx.call_script
inside a State function.I have played around with it, and it seems that
call_script
is not executed if it is not part of a return statement. Why?My particular use case is that I am adding a html canvas via
rx.html
and controlling it using browser javascript, called from event handlers of reflex buttons and fields. Inside one those event handlers, I would ideally like to go, "python code -> call_script -> more python code". But it seems this is not possible.Beta Was this translation helpful? Give feedback.
All reactions