I'm creating a physically accurate light on Blender to recreate the Sunlight for a spatial scene. I'm using python Blender and i cannot understand how to connect shader Nodes, in particular the blackbody one, to light model. I'm using the code reported below, but the result is a total white light, without any input of color due to the shader Node. Thanks for your help!
bpy.ops.object.light_add(type='SUN', align='WORLD', location=(0, 0, 0), scale=(1, 1, 1))
bpy.context.active_object.name = SunLight["name"]
bpy.context.active_object.data.energy = SunLight["irradiance"]
bpy.context.active_object.data.angle = SunLight["angle"] / 57.2957795
bpy.context.active_object.rotation_euler = SunLight["rotation"]
bpy.context.active_object.data.use_nodes = True
light = bpy.context.active_object.data
nodes = light.node_tree.nodes
lights_output = nodes.get('Light Output')
lights_output.location = 0, 0
lights_output.width = 180
node_ox = nodes.get('Emission')
node_ox.location = -200, 0
node_ox.width = 180
links = light.node_tree.links
node_bb = nodes.new(type="ShaderNodeBlackbody")
node_bb.inputs[0].default_value = SunLight['temp']
node_bb.location = -400, 0
node_bb.width = 180
link = links.new(node_bb.outputs[0], node_ox.inputs[0])
I've seen that some others had obtained the wanted result with a similar code, but i can't understand the mistake.

