I’m writing a python script that I want to be controlled by a geometry node modifier menu switch that’s plugged into the group input of geometry nodes.
When I select an option in the drop down menu, the info window displays this code:
bpy.context.object.modifiers["GeometryNodes"]["Socket_4"] = 'F'
But when I try putting that into the blender terminal, I get this error:
>>> bpy.context.object.modifiers["GeometryNodes"]["Socket_4"] = 'F'
Traceback (most recent call last):
File "C:\Program Files\Blender Foundation\Blender 4.3\4.3\python\Lib\code.py", line 90, in runcode
exec(code, self.locals)
File "<blender_console>", line 1, in <module>
TypeError: Cannot assign a 'str' value to the existing 'Socket_4' Int IDProperty
Is there to assign a menu switch using a string like ‘F’?
I can update the menu by index (A = 0, B = 1, C = 2, etc) but if I change the order of the menu items, they retain their original index. So if I make C first on the drop down menu, it’s still index 2.
Is there a workaround for this?