Code|Python Previous Node Data Reference Broken

Describe the problem/error/question

Im using Python in a code node to manipulate data. Ever since upgrading to v2, referencing specific nodes no longer works and I receive the error name '_' is not defined. I am using the documented node reference stated here: Output of other nodes | n8n Docs

What is the error message (if any)?

name '_' is not defined

Please share your workflow

Share the output returned by the last node

[
{
“customer”: {
“id”: “XXXXXXXXXXXXXXXXXXXXXXXXXX”,
“created_at”: “2025-12-23T15:01:28.821Z”,
“updated_at”: “2025-12-23T15:01:28Z”,
“given_name”: “FIRST_NAME”,
“family_name”: “LAST_NAME”,
“email_address”: “[email protected]”,
“phone_number”: “+5555555555”,
“preferences”: {
“email_unsubscribed”: false
},
“creation_source”: “DIRECTORY”,
“segment_ids”: [
“MLXYHWJM63XZH.REACHABLE”,
“gv2:Y0MGXB3N9H77H829CC2KWGCGWW”,
“gv2:YEMVYVNS5118FAHFFQ5MRDJNQC”
],
“version”: 0
}
}
]

Information on your n8n setup

  • n8n version: 2.1.3
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app): cloud
  • Operating system: N/A
1 Like

Version2 changed the way a lot of things worked, including python workers.

You can’t use (‘Square - Get Order’).all() anymore, but you can use input or _items

change it to input_data = _items hopefully that should fix it.

Does that get read in as a JSON object im assuming?

yea since n8n v2 changed things it might be a json object, im not sure. But i would try items or input.