ID 613137 - Node.dependencies() returns an empty list on its first call in some scripts in Terminal mode

Follow

Problem summary
Node.dependencies() returns an empty list on its first call in some scripts in Terminal mode.
The issue does not occur in the Script Editor and has been reproduced in a simple script containing a Remove node, TimeOffset node, and a Crop node with expressions.
 
Customer reported version
Nuke 16.0v5
 
Customer reported platform
Rocky 9
 
Steps to reproduce
 
1) Open Nuke.
 
2) Paste the following script into the Node Graph, and save the script:

Remove { } TimeOffset {  time_offset -50  time "" } Crop {  box {{input.bbox.x} {input.bbox.y} {input.bbox.r} {input.bbox.t}}  reformat true  crop false }
 
3) Open the script in terminal mode:
nuke -ti script.nk
 
4) Run the following lines of Python:
node = nuke.toNode("Crop1")print(f"{node.dependencies()=}")
RESULT: An empty list is printed.
 
5) Run this line of Python code again:
print(f"{node.dependencies()=}")
RESULT: The upstream node (TimeOffset1) is printed in a list. 
 
Expected behaviour
node.dependencies() should print the upstream node in a list, in this case TimeOffset1, the first time it is run.
 
Actual behaviour
node.dependencies() prints an empty list when it is first run, but returns the correct node on the 2nd attempt.
 
Workaround
Unknown. 
 
Reproduced by support
This bug has been reproduced in:
Nuke 16.0v8 - Windows 11 - MacOS 15 (Sequoia)
Nuke 16.0v5 - Windows 11
Nuke 16.0v4 - Windows 11
Nuke 16.0v3 - Windows 11
Nuke 16.0v2 - Windows 11 - MacOS 15 (Sequoia) - REGRESSION
 
Unable to reproduce bug in:
Nuke 16.0v1 - Windows 11 - MacOS 15 (Sequoia)
 
Earliest version tested
Nuke 16.0v1
- This issue doesn't appear in this version and has regressed
 

    We're sorry to hear that

    Please tell us why