# How to set Inputs for GeometryNodes Modifiers with Code and Debug?

**URL:** <https://blenderartists.org/t/how-to-set-inputs-for-geometrynodes-modifiers-with-code-and-debug/1656979>\
**Category:** Python Support\
**Tags:** geometry-nodes\
**Created:** [November 6, 2026, 3:46pm UTC](https://blenderartists.org/t/how-to-set-inputs-for-geometrynodes-modifiers-with-code-and-debug/1656979 "2026-11-06T15:46:16Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![CsM\_J](https://blenderartists.org/user_avatar/blenderartists.org/csm_j/32/1398863_2.png) [@CsM\_J](https://blenderartists.org/u/CsM_J)\
**Post date:** [November 6, 2026, 3:46pm UTC](https://blenderartists.org/t/how-to-set-inputs-for-geometrynodes-modifiers-with-code-and-debug/1656979/1 "2026-11-06T15:46:16Z")

</div>

I was trying to create a Drawing Excercise addon for myself with different challenges, so I made a bunch of Geometry Node setups where each one has a `Seed` input socket that I want to set with code

A modifier looks something like this:

 ![kép](https://blenderartists.org/uploads/default/original/4X/9/5/6/95614524bbc7f0c89236b439e25c4c10b433678c.png)

Here is the relevant code snippet:

```py
mod = obj.modifiers.new(name=modf, type='NODES')
mod.node_group = ng

seed = random.randint(0, 1000)
for item in ng.interface.items_tree:
    if item.item_type == "SOCKET" and item.in_out == "INPUT":
        if item.name == "Seed":
            # Set the value on the modifier instance using its identifier
            seed_var = getattr(mod.properties.inputs,item.identifier)
            seed_var.value = seed
            break

```

This works but it feels _hacky_ since `properties` supposed to be _readonly_

I tried to set it with:

```py
mod[item.identifier] = seed

```

as I see suggested in other posts but I get this error:  
 ![kép](https://blenderartists.org/uploads/default/original/4X/1/5/1/1516bbcd661a4e83017d7533594139f9d4787f19.png)

I tried looking at the documentation here: [NodesModifier](https://docs.blender.org/api/5.2/bpy.types.NodesModifier.html)  
Where it said `properties` is of type `NodesModifierProperties` but when I tried to print the type() it said `GeometryNodesModifierInterface` which I found no documentation for also when I try to access the .values() or .items() I get this error:  
 ![kép](https://blenderartists.org/uploads/default/original/4X/6/7/6/676bf6bb89f50918a004022b686088ccb1a7ebfd.png)  
Eventhough they are listed in the _Inherited Functions_ section  
So I really don’t know how to debug such objects other than dir() the whole thing.  
I just wanted to share this to eliviate my frustration whith the horrendous API documentation.

Am I missing something, is there a better way?

---

<div class="post-metadata">

**Author:** ![romansi1](https://blenderartists.org/user_avatar/blenderartists.org/romansi1/32/1506035_2.png) [@romansi1](https://blenderartists.org/u/romansi1)\
**Post date:** [November 7, 2026, 9:29pm UTC](https://blenderartists.org/t/how-to-set-inputs-for-geometrynodes-modifiers-with-code-and-debug/1656979/2 "2026-11-07T21:29:38Z")

</div>

that’s not hacky actually, that’s the new way. in 5.x the geo nodes modifier inputs moved to mod.properties.inputs, the old mod[“Socket\_2”] = x idea property style is gone, which is why that errors on you

you can skip the loop too:

```python
ident = ng.interface.items_tree["Seed"].identifier
getattr(mod.properties.inputs, ident).value = random.randint(0, 1000)

```

if you also need it to run on 4.x, check hasattr(mod, “properties”) and fall back to mod[ident] = seed there

---

<div class="post-metadata">

**Author:** ![system](https://blenderartists.org/uploads/default/original/4X/3/5/9/359f93d9347d57148196b3b4c3f3528f831e2f47.png) [@system](https://blenderartists.org/u/system)\
**Post date:** [November 9, 2026, 9:30pm UTC](https://blenderartists.org/t/how-to-set-inputs-for-geometrynodes-modifiers-with-code-and-debug/1656979/3 "2026-11-09T21:30:26Z")

</div>

Closed on November 9, 2026, 9:30pm UTC

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.
