Python in Nuke:
Nuke: saveToRenderPath.py
I use Python scripting extensively in Nuke to automate things.
In this example, the python script saves a version of the nuke script into the destination folder specified in the selected write node's file path. This script can be called as part of a custom write node execute command in order to force a Nuke script to be saved with every render.
Have a look at a screen grab of the script.
Get the code for saveToRenderPath.py here