Variable in scripts called in scripts (subscripts)

Hi,
I know how to pass variables to scripts, but I would like to know how to make these variables available in subscripts also, just like an “export variable” would do in Unix…

An example of what I want to do :
Automations:

    - service: script.turn_on
      entity_id: script.test_script
      data:
        variables:
          my_variable: "SuperVar"

Scripts :

  test_script:
      - service: notify.telegram_xxx
        data:
          message: "Variable in main script is {{ my_variable }} "
      - service: script.turn_on
        entity_id: script.test_subscript
  test_subscript:
    sequence:
      - service: notify.telegram_xxx
        data:
          message: "Variable in subscript is {{ my_variable }} "

I receive in Telegram :

Variable in main script is SuperVar
Variable in subscript script is

I know I could call my subscript setting the variables again, but I have scripts calling scripts and it’d be cleaner to have the variables available for all subscripts instead of having to declare for every call of a script.

Thanks

    - service: script.turn_on
      entity_id: script.test_script
      data:
        variables:
          my_variable: "SuperVar"

Scripts :

  test_script:
      - service: notify.telegram_xxx
        data:
          message: "Variable in main script is {{ my_variable }} "
      - service: script.turn_on
        entity_id: script.test_subscript
        data:
          variables:
            my_sub_variable: "{{ my_variable }} "
  test_subscript:
    sequence:
      - service: notify.telegram_xxx
        data:
          message: "Variable in subscript is {{ my_sub_variable }} "

Hi,
Indeed as I said in my post I know I can keep on setting variables and sub variables for each scripts calls, but it’ll get messy quickly.
If there is no other way that’s what I’ll do but it’d be cleaner to be hable to propagate a value.

The variable I want to pass is volume and media player entity for a custom alarm played on Google Homes.
I have scripts to prepare alarm, turn on, turn off, restore state, etc… And so for instance the volume and entity should be passed from the main script to all possible sub-scripts. I can set all variables in each script calls each time, but that’s a lot of overhead.

Hi,

So just to confirm, what I wish to do is not possible, right ? The only way is to declare the variables for each script call…

Thanks.