# Getting output socket name and using it for input socket name in compositor

i'm trying to do an automated naming system for my file outputs in blender compositor, i want the file output input's socket to get the name of the input of their respective links. I'm not really getting how (new in python). So far my script looks like

import bpy
import os

# Get absolute path:
filepath = bpy.context.scene.render.filepath
absolutepath = bpy.path.abspath(filepath)

# Split it
path = os.path.normpath(absolutepath)
parts = path.split(os.sep)

absolutepath = os.sep.join(parts[:-2])

# Get name of th input
name01 = bpy.data.node_groups["CYCLES MULTIPASS CREATION"].outputs[0].name

# set the path for all file output nodes:
for scene in bpy.data.scenes:
for node in scene.node_tree.nodes:

if node.type == 'OUTPUT_FILE':
node.base_path = absolutepath
node.file_slots[0].path = "\_shadow\_" + "nom" + "_" + name01


But this is "absolute" version of what i'm trying to do, the input socket name is not relative to the output socket name of the previous node... Somebody has an idea ? thank you very much !

#using the File output node from your example

• i mean is it possible to just put something like link = node.inputs.links[0] without an imput number to get something applyable to all the input immediatly ? – tonton Jan 5 '17 at 17:56