# Pass variable between tasks

**URL:** <https://cylc.discourse.group/t/pass-variable-between-tasks/354>\
**Category:** Cylc Support\
**Created:** [July 7, 2021, 1:14pm UTC](https://cylc.discourse.group/t/pass-variable-between-tasks/354 "2021-07-07T13:14:17Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![schaferk](https://yyz2.discourse-cdn.com/free1/user_avatar/cylc.discourse.group/schaferk/32/92_2.png) [@schaferk](https://cylc.discourse.group/u/schaferk)\
**Post date:** [July 7, 2021, 1:14pm UTC](https://cylc.discourse.group/t/pass-variable-between-tasks/354/1 "2021-07-07T13:14:17Z")

</div>

two tasks A-\>B

A determines a value that B would like to use.

could have A write to a file, and then B read the file.

is there a method within cylc to pass values between tasks?

---

<div class="post-metadata">

**Author:** ![oliver.sanders](https://yyz2.discourse-cdn.com/free1/user_avatar/cylc.discourse.group/oliver.sanders/32/110_2.png) [@oliver.sanders](https://cylc.discourse.group/u/oliver.sanders)\
**Post date:** [July 7, 2021, 4:08pm UTC](https://cylc.discourse.group/t/pass-variable-between-tasks/354/2 "2021-07-07T16:08:02Z")

</div>

Hello,

The `cylc broadcast` command allows you to modify items in the `[runtime]` section of the workflow configuration. It is often used to set environment variables for tasks.

There is a tutorial for this confusingly hidden in the Rose documentation (will be moved into the Cylc docs soon):

[http://metomi.github.io/rose/doc/html/tutorial/cylc/furthertopics/broadcast.html](http://metomi.github.io/rose/doc/html/tutorial/cylc/furthertopics/broadcast.html)

Sometimes the filesystem is the better way to exchange data, some quick notes:

- Broadcasts can be set, reset and cleared, they appear in `cylc review`.
- Broadcasts can target multiple tasks, or entire cycles.
- Jobs run with any settings broadcasted when the job was submitted (whereas if you change a file that could take effect whilst a task is running).
- Broadcasts can change `[runtime]` settings (including `[environment]` variables but excluding `inherit`).
- Broadcasts require http(s) or ssh+http(s) task comms (i.e. can’t work with polling task comms).
- Broadcasts work for tasks run on platforms with different filesystems where using files would be tricky.
- Broadcasts are not suitable for serialising data structures (e.g. Python pickle)
