The workaround I have found for my problem consists in the called script to trigger a manual event that will include whatever information and variables I want, followed by the STOP command (with no response in that one).
In the calling script, I call the other in parallel, altogether with a wait for trigger - event that will capture the information sent by the called script. Note that whatever command following the wait for trigger must be at the same level of sequence than the wait for trigger (at least for my use case).
Here is a model of what I did:
- parallel:
- service: script.example
data:
some_variable: some information
- sequence:
- wait_for_trigger:
- platform: event
event_type: my_personal_event
event_data:
success: true
id: is_finished
- some other stuff etc:
In the called script, it looks like this:
- event: my_personal_event
event_data:
success: "{{ boolean_variable }}"
It works. If it was only a matter of variable scope it wouldn’t work.
That’s a workaround I dislike, but that’s the best I found so far.
I noticed other people are facing the same kind of challenge here.