Very noob question here, I am probably missing something and can't get my code to work properly. I want to create a new object, cube or whatever, add a Geometry nodes modifier to it and select from a drop down menu an existing, 'Fake user' group named 'Mygroup'. This last part is not working properly, I cannot get it to select that group even though if I go manually I can see it and select it normally. Most recently I tried answers from this post and modified it to correct name but id doesn't work. I am using Blender 3.31 and as I write 3.4.
My code looks like this:
import bpy bpy.ops.mesh.primitive_cube_add(enter_editmode=False, align='WORLD', location=(0, 0, 0), scale=(1, 1, 1)) bpy.ops.object.modifier_add(type='NODES') bpy.data.node_groups['Mygroup']