.. _how_to_cross_reference:

How to connect multiple workflows?
==================================

Here is an example of how one can generate multiple workflows, and then generate one more workflow
which would combine them. The key point is to realize that the workflow instances are created in the ``def workflow`` function
give access to task references, which can then further on supplied to the workflows which combine these workflows.

Below is an example, which creates two sets of workflows, and then creates one more set of workflows which are taken to
be the product of these workflows.

.. tbinit:: howto_cross_reference

.. tbfile:: workflow.py

Create a following script ``workflow.py``:

.. literalinclude:: workflow.py

We can now run the workflow and observe that we have crosstabulated the "molecules"
and the "nanoparticles".

.. tbshellcommand:: tb init

.. tbshellcommand:: tb workflow workflow.py

.. tbshellcommand:: tb run .

.. tbshellcommand:: tb ls -cosirITf



