ID 546140 - Deleting a node with TCL-triggered Python on startup causes the Node Graph to not update correctly

Follow

Problem summary
Deleting a node with TCL-triggered Python on startup causes the Node Graph to not update correctly.
 
Customer reported version
Nuke 14.0v4
 
Customer reported platform
Windows 11
 
Steps to reproduce
 
1) Copy the following script into a text editor and save it to a .nk file:

python -exec {dot = nuke.createNode('Dot')grade = nuke.createNode('Grade')nuke.delete(grade)}
 
2) Launch Nuke and provide the path of the script as an argument, to open it on startup. For example:
"C:\Program Files\Nuke14.0v5\Nuke14.0.exe" --safe "C:\temp\myTest.nk"
 
3) Notice that the script opens with a Dot node and a Grade node (which does not exist in the Node Graph) in the Properties panel:
 

 
4) Try to create any node in the Node Graph. Notice that the nodes do not appear in the Node Graph, but are opened in the Properties panel.
 
5) Select the Dot node in the Node Graph and delete it. Notice that the Nodes you tried creating in step 4 now appear.
 
Expected behaviour
The Python code (triggered via TCL) should be executed on startup, and the Grade node should not appear in the Properties panel. Users should be able to add additional nodes to the Node Graph as expected.
 
Actual behaviour
The Grade node (which should be deleted by the TCL-triggered Python code) still appears in the Properties panel. This also prevents new nodes from being added to the Node Graph.
 
Workaround
You may be able to workaround the issue by wrapping the Python code into a function, and calling it with a QTimer. For example, save the following into a .nk script:
python -exec { def test():     dot = nuke.createNode('Dot')     grade = nuke.createNode('Grade')     nuke.delete(grade) from PySide2.QtCore import QTimer QTimer.singleShot(100, lambda: test()) }
 
Reproduced by support
This bug has been reproduced in:
Nuke 14.0v5 - Windows 10 - Linux CentOS 7
Nuke 12.0v1 - Windows 10 - Linux CentOS 7
 
Unable to reproduce bug in:
Nuke 10.0v1 - Windows 10 - Linux CentOS 7
 
Earliest version tested
Nuke 10.0v1 
- This issue doesn't appear in this version and has regressed between Nuke 10.0v1 and 12.0v1.
 

    We're sorry to hear that

    Please tell us why