I would like to store my whole node input driver set up of a material in a txt file and load it back any time. How can I access the driver data along with node name and input number?
Python console code. Loop thru materials that use nodes and have animation data, if so loop the drivers collection.
In simple example below find the couple of simple drivers including a driver on a value node with expression "frame" (the current frame)
The drivers datapath gives the node name and the index of the socket.
>>> for m in bpy.data.materials: ... m.name ... if m.use_nodes and m.node_tree.animation_data: ... for d in m.node_tree.animation_data.drivers: ... d.data_path, d.driver.expression ... 'Material' ('nodes["Value"].outputs.default_value', 'frame') ('nodes["Principled BSDF"].inputs.default_value', 'frame / 20') >>>
Re socket index and name https://blender.stackexchange.com/a/160069/15543