How to use execute Workflow with data from a few nodes back?

Describe the issue/error/question

If I retrieve data via a node, iterate over the results, do sth else, depending on the results of sth else and then, I’d like to pass the initial data to a workflow.

If I just connect the if/else results to the ExecuteWorkflow, their data will be passed on to the Sub-Workflow.
How to use the initial data / items from a few nodes back?

Please share the workflow

Information on your n8n setup

  • n8n version: 0.182.0
  • Database you’re using (default: SQLite): SQLite
  • Running n8n with the execution process [own(default), main]: own
  • Running n8n via [Docker, npm, n8n.cloud, desktop app]: Docker

Hey @Chris7935, you can reference data from other nodes using the $items() or $item() methods. Check out the documentation here.

Simply fetch the data you need before calling the Execute Workflow node.

I was afraid of this answer.
So if my workflow is growing to 50 - 80 nodes and I’d like to split things up into modules, I’d need to add one Function node, every time before I call a Workflow?