Ron Jensen's comment was the solution! Thank you!
My goal is to cycle through a bunch of different materials that have image textures, and link the alpha output of the image texture to a Principled BSDF node that is also in the material. What I have at the moment doesn't work, and while I do know a little bit of python, I don't think I have a deep enough understanding of blender's libraries to figure this out on my own.
This is patched together from this highlighted youtube comment and BlenderBoi2018's post here:
import bpy from bpy_extras.node_shader_utils import PrincipledBSDFWrapper # Run through all materials of the current blend file for mat in bpy.data.materials: # If the material has a node tree if mat.node_tree: # Link alpha from image texture to alpha on principled bsdf mat.node_tree.links.new(PrincipledBSDFWrapper.inputs["Alpha"], image_tex.outputs["Alpha])
My (potentially very wrong) understanding of the last line is material name.the material's node tree.links between nodes.new link(target node.input slot[name], node to link from.output slot[name]). Somebody please explain it if I have that wrong. The use of PrincipledBSDFWrapper comes from here:
But it doesn't seem to be intended for use in that way.
I couldn't find a bl_idname for the Pricipled BSDF, which I think would have worked in this context, but I don't know that for sure. If I have all my information correct my holdup here is figuring out how to specify which node is which.