Accessing 'Group Input' from python scripting when switching language

Hey there :slight_smile:

please apologize if this is a weird question, but im stuck here. I am working on a script, that is creating and connecting some geometry nodes. This minimum example is creating a node of type ‘Mesh to Curve’. Furthermore this new node is connected to the ‘Group Input’:

import bpy

# get object
obj =['Cube']

# create group
modifier_nodes ='test', type='NODES')
node_group = obj.modifiers['test'].node_group

# add new node"GeometryNodeMeshToCurve")

# link the new node to the group input
input = node_group.nodes['Mesh to Curve'].inputs['Mesh']
output = node_group.nodes['Group Input'].outputs['Geometry'], output)

This is working fine, if the default language is set to english. When the user is changing the default language, an error message is dropped:

KeyError: ‘bpy_prop_collection[key]: key “Mesh to Curve” not found’

I guess the problem here is, that the geometry node ‘Group Input’ is called differently in every language. When switching to german for example, it is called ‘Gruppeneingabe’, in spain it is called ‘Entradas del grupo’.

I can avoid this issue for every new node by assigning a specific name to it. But how can i access the ‘Group Input’ in every language? (and later on the output)

I have tried to acces:['Cube'].modifiers['test'].node_group.nodes[0]
But this is not necessarily the ‘Group Input’ in all languages.

Thank you in advance!


Ok, without warranty:
It looks like input and output sticks to index 0 and 1.

group_input =['Cube'].modifiers['test'].node_group.nodes[0]
group_output =['Cube'].modifiers['test'].node_group.nodes[1]

When switching language, the input and output of each node is also called differently.
This will lead to an error like:

KeyError: 'bpy_prop_collection[key]: key "Geometry" not found'

At first glance, it looks like each input and output can be accessed by id:

  # mesh to curve
  mtc ="GeometryNodeMeshToCurve")
  input = mtc.inputs[0] # ['Mesh']

But any cleaner approach is appreciated :slight_smile: