# Not able to add node sockets to an existing node using python scripting

I am trying to add a new input NodeSocket to an existing node using the below code:

tree = bpy.context.scene.node_tree
tree.nodes['File Output'].inputs.new('RGBA', 'Image')
tree.nodes['File Output'].update()


Below are the nodes that I have created for my blend file.

As shown in the above image, the "File Output" node has 5 input sockets. The above code should add a 6th one, however it is not adding. Am I missing something here?

• Thanks. output_node.layer_slots.new("my_new_input_socket") – Sibbs Gambling Aug 25 '18 at 21:05