ID 591870 - Python import statements produce SyntaxErrors when used in CopyCat's beforeFrameRender and afterFrameRender knobs

Follow

Problem summary:
Python import statements produce SyntaxErrors when used in CopyCat's beforeFrameRender and afterFrameRender knobs
 
Customer reported version:
Nuke 14.1v5
 
Customer reported platform:
CentOS 7
 
Steps to reproduce:
1) Launch NukeX and create a CopyCat node in the Node Graph.
2) In the Properties panel, set the Data Directory knob to a valid location.
3) Switch to the Python tab, then enter import random into the beforeFrameRender knob, and import time into the afterFrameRender knob.
4) Attach the CopyCat's GroundTruth and Input connections to a CheckerBoard node.
5) Start the Training and observe the SyntaxError messages displayed in the Terminal:

SyntaxError: invalid syntax  File "<string>", line 1    import time    ^^^^^^SyntaxError: invalid syntax  File "<string>", line 1    import random    ^^^^^^
 
Expected behavior:
import statements should not produce a SyntaxError when placed inside any of the CopyCat node's Python callback knobs.
 
Actual behavior:
Attempting to utilize an import statement inside the beforeFrameRender or afterFrameRender knobs of a CopyCat node will result in SyntaxErrors during training. In some situations this seems to cause Nuke to become unstable and crash, but the problem is not consistently reproducible.
 
Workaround:
Python import statements can be placed inside the CopyCat node's beforeRender knob instead, and methods from those modules can then be used inside the beforeFrameRender and afterFrameRender knobs as desired.
 
Reproduced by Support in:
NukeX 15.1v4 - Windows 10, macOS 14 Sonoma
NukeX 14.1v1 - Windows 10
NukeX 14.0v1 - Windows 10
NukeX 13.2v1 - Windows 10 -- Regression
 
Unable to reproduce bug in:
NukeX 13.1v5 - Windows 10
 
Earliest version tested:
NukeX 13.1v5 - This issue doesn't appear in this version and has regressed

    We're sorry to hear that

    Please tell us why