I found the AddPorts() Method,Sorry I missed it before.
from typing import Optional
import c4d
import maxon
doc: c4d.documents.BaseDocument # The active document
op: Optional[c4d.BaseObject] # The active object, None if unselected
def main() -> None:
material = doc.GetActiveMaterial()
nodeMaterial = material.GetNodeMaterialReference()
graph: maxon.GraphModelInterface = nodeMaterial.GetGraph(c4d.GetActiveNodeSpaceId())
with graph.BeginTransaction() as transaction:
layered_node = graph.AddChild(maxon.Id(),"com.chaos.vray_node.texlayeredmax")
layers = layered_node.GetInputs().FindChild("com.chaos.vray_node.texlayeredmax.texture_layers") #The Layers portbundle
layers.AddPorts(2, 1) #Add layers
transaction.Commit()
#Layer in Layers portbundle
layers_list = []
layers.GetChildren(layers_list,maxon.NODE_KIND.INPORT)
#Textureports and BlendMode_ports in Layers portbundle
layers_texport_list = [tport for port in layers_list if (tport := port.FindChild("com.chaos.vray.portbundle.texture_layer.texture"))]
layers_mode_list = [mport for port in layers_list if (mport := port.FindChild("com.chaos.vray.portbundle.texture_layer.blend_mode"))]
print(layered_node)
print(layers)
print(layers_list)
print(layers_texport_list)
print(layers_mode_list)
if __name__ == '__main__':
main()