ID 464899 - User knobs that call expressions via Python do not update in real time when a frame is changed

Follow

Problem summary
There are several methods to call expressions into a user knob, the two most common being Python and TCL.

When a Python expression is called via a user knob, it has been found that when a frame is changed the user knobs value does not update automatically.

Note: This does not occur when the User knob is calling an expression via TCL and the changes are updated automatically.

Customer reported version
nuke.12.2v2

Customer reported platform
rhel7

Steps to reproduce

1) Paste the following code snippet into a new Nuke script
set cut_paste_input [stack 0]
version 12.2 v4
Constant {
 inputs 0
 name Constant1
 selected true
 xpos 642
 ypos -197
 addUserKnob {20 User}
 addUserKnob {3 val}
 val {{curve x1 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100}}
}
Expression {
 expr0 tclExpr
 expr1 pyExpr
 channel2 {-rgba.red -rgba.green -rgba.blue none}
 channel3 {none none none -rgba.alpha}
 mix_luminance {0}
 mix {1}
 name Expression1
 selected true
 xpos 642
 ypos -88
 addUserKnob {20 User}
 addUserKnob {3 tclExpr}
 tclExpr {{input.val}}
 addUserKnob {3 pyExpr}
 pyExpr {{"\[python nuke.thisNode().input(0)\\\['val'\\].value()]"}}
}

2) Open the Expression node's User tab

3) Viewing the Expression node, change between two frames that are far apart, eg. 1 and 80
Result: The python generated expression will stay at the last frame in the user knob, whereas the TCL generated expression wont.

Expected behaviour
User knobs that use expressions generated via python should update in real time when frames are changed

Actual behaviour
User knobs that use expressions generated via python are always set to the previous frame when changing frames

Workaround
When possible use a TCL function for User knobs when calling expressions.

Reproduced by support
This bug has been reproduced in:
Nuke 12.2v4 - Windows 10 - CentOS 7 - MacOS 10.15.6
Nuke 12.2v1 - Windows 10
Nuke 12.1v1 - Windows 10
Nuke 12.0v1 - Windows 10
Nuke 11.3v1 - Windows 10
Nuke 11.2v1 - Windows 10
Nuke 11.1v1 - Windows 10
Nuke 11.0v1 - Windows 10
Nuke 10.5v1 - Windows 10
Nuke 10.0v1 - Windows 10

Unable to reproduce bug in:
Nuke 9.0v9 - Windows 10 - CentOS 7 - MacOS

Earliest version tested
Nuke 9.0v9
- This issue doesn't appear in this version and has regressed

    We're sorry to hear that

    Please tell us why