How to link the output of a Vector Math node to another node? I try to build a operator for some specific shaders by using Python but got stuck on how to make a node connection between ColorRamp (input) and Vector Math (output):

When I try to use shadername.links.new(VectorMath.outputs[0], ColorRamp.inputs[0]) both nodes are disconnected and I am not sure why:

Some coding excerpt:
 #colorRamp
    ramp = mat_ruby.node_tree.nodes.new(&quot;ShaderNodeValToRGB&quot;)
    ramp.location = (-800,100)

    ramp.color_ramp.elements[0].position=0.102
    ramp.color_ramp.elements[0].color = (0.215861,0,0.017642,1)
  
    ramp.color_ramp.elements.new(0.636)
    ramp.color_ramp.elements[1].color = (0.396755,0,0.032,1)

    ramp.color_ramp.elements.new (0.794)
    ramp.color_ramp.elements[2].color = (0.701102,0.147,0.016,1)
    
    ramp.color_ramp.elements.new(0.893)
    ramp.color_ramp.elements[3].color = (1.0,0.292,0.0,1)

    ramp.color_ramp.elements[4].position = 1
    ramp.color_ramp.elements[4].color = (1.0,1.0,1.0,1)
   
    mat_ruby.node_tree.links.new(ramp.outputs[0], glassA.inputs[0])
    

  
    math = mat_ruby.node_tree.nodes.new('ShaderNodeVectorMath')
    math.location = (-1000,100)
    math.operation = 'DOT_PRODUCT'
    mat_ruby.node_tree.links.new(math.outputs[0], ramp.inputs[0])

Q: How can I link the output of a Vector Math node to the input of eg. a Color Ramp?
The Vector Math node actually has 2 outputs : One of type Vector, and one of type float. They get hidden / shown depending on the node's operation.
The float type is accessed with the second index of the outputs. Change your last line to :
mat_ruby.node_tree.links.new(math.outputs[1], ramp.inputs[0])

Or (not advised since it is language-dependant)
mat_ruby.node_tree.links.new(math.outputs[&quot;Value&quot;], ramp.inputs[0])