[Question] Copy existing node group to new material through python

My intent is to copy an existing node group to a new material via script.

I can reference it with bpy.data.node_groups[‘Group_Name’].

As the group is pretty complex, I’m not smart enough to create it from scratch via script. Also, if I "print(py.data.node_groups[‘Group_Name’].nodes) from the console, it outputs “<bpy_collection[19], Nodes>”. Is there a way to list out all the nodes so I know how to connect them?

Overall I’m trying to create a script that maps textures to a PBR material based on the name of the texture. I spend way too much time mapping these materials, which can be for 40+ objects. Seems like a logical enough script because my textures use a consistent naming convention. I just have no idea what i’m doing… :smiley:

Thank you for your help!

this is for cycles ?

why not just copy the material then !
should work
no nodes script

happy cl