Wrong node input in hiero exported nuke script

Hey everyone,
I have created a nuke script via the Shotgun Nuke Project File Exporter in hiero.
I have added a set command and several push commands within the exporter, to set the same input to all shotgun write nodes.

When I open the created script outside of Shotgun everything is good. The placeholder Nodes do have the dot as input Node. But when I open the same script within Shotgun the Shotgun Write Nodes are connected to each other in a row.

Does anyone know, where this behaviour is coming from, since it seems to be exported correctly.

normal sg

if anyone is interested, below is the nuke file as text:
Dot {
 name Dot1
}
set N35e3000 [stack 0]
ModifyMetaData {
 metadata {
  {set output ""}
  {set name "Mono EXR"}
 }
 name ShotgunWriteNodePlaceholder
 xpos 370
 ypos 663
}
push $N35e3000
ModifyMetaData {
 metadata {
  {set output ""}
  {set name "Mono JPEG"}
 }
 name ShotgunWriteNodePlaceholder1
 xpos 370
 ypos 703
}
push $N35e3000
ModifyMetaData {
 metadata {
  {set output -srgb}
  {set name "Mono JPEG"}
 }
 name ShotgunWriteNodePlaceholder2
 xpos 370
 ypos 743
}

Thanks a lot for your help.

Cheers,
Henna

After a little digging, I found the error.

It is in the tk-nuke-writenode app, in the handler.py file:

if not node_found:
    node_found = True
    try:
        n.dependencies()[0].setSelected(True)
    except:
        pass

node_found is set to False before the loop
This selects the input of the first placeholder (and in this case the others too) and hence changes the inheritance of the other nodes when creating the first ShotgunWrite.

For future reference:
I fixed it for us, by changing the for-loop from

node_found = False
for n in nuke.allNodes("ModifyMetaData"):
    if not n.name().startswith("ShotgunWriteNodePlaceholder"):
        continue
    ...

to

node_found = False
nodes = []
for n in nuke.allNodes("ModifyMetaData"):
    if n.name().startswith("ShotgunWriteNodePlaceholder"):
        nodes.append([n, n.dependencies()[0]])

for n, i in nodes:
    ...

and then made sure the input is set

new_node.setInput(0, i)