title: How to update nuke.frame() value in NUKE via Python?
body: <p>I want to automatically play and stop the sequence in The Foundry NUKE using <code>if...else</code> conditional statements. I can easily start playing the sequence but I can't stop it. The problem is a value <code>nuke.frame()</code> doesn't update. If someone has any experience on this issue, please help me.</p>
  
  <p>Here's a code:</p>
  
  <pre><code>checker = nuke.createNode('CheckerBoard2', 'boxsize 100 centerlinewidth 0')
  blur = nuke.createNode('Blur', 'size sin(frame/10)*25', inpanel=False)
  merge = nuke.createNode('Merge2', inpanel=False)
  wheel = nuke.createNode("ColorWheel", 'rotate frame*10 centerSaturation 1')
  merge.connectInput(0, wheel)
  nuke.toNode('Merge1').setSelected(True)
  nukescripts.connect_selected_to_viewer(0)
  
  for all in nuke.allNodes():
      all.setSelected(True)
  _autoplace()
  
  f = nuke.frame(1)
  
  def playBlast():
      if f &gt;= 1 and f &lt;= 99:
          nuke.activeViewer().play(1)
          return        
      else:
          nuke.activeViewer().stop()
          print f
  
  playBlast()
  </code></pre>