[SOLVED] Node tree not updated after change parameter

Hi!
I want to change the read node filename parameter in a python script run in a interpreter mode Natron. When changing the filepath of a read through python this way: read_node.getParam('filename').setValue('new_####.exr') the layers are not updated, that is, it does not show them when doing read_auxiliar_node.getAvailableLayers(0) in a node that is conected to de read_node. It keeps showing me the same layers that the previous filename had and not the new ones.

This is the code:

read_node = natron_app.createNode('fr.inria.built-in.Read')
read_node.beginChanges()
read_node.getParam('filename').setValue('new_####.exr')
read_node.getParam('filename').reloadFile()
read_node.endChanges()

read_auxiliar_node = natron_app.createNode('net.sf.openfx.TransformPlugin')
read_auxiliar_node.beginChanges()
read_auxiliar_node.setLabel('read_auxiliar')  # It is not posible to view the layer directly from de read node.
read_auxiliar_node.connectInput(0, read_node)
read_auxiliar_node.endChanges()

pprint.pprint([x.getLayerName() for x in read_auxiliar_node.getAvailableLayers(0)])

And this is how a run the script:

START /B /WAIT "" "C:\Program Files\Natron\bin\Natron.exe" -t %MYSCRIPT%

Thanks you very much. I hope you can help me!

Darío :slight_smile:


SOLUTION:

In line read_node.getParam('filename').setValue('new_####.exr') you chan only use #### only if there really is more than one file. If there are a file named “new_0001.exr” and “new_0002.exr” it works. If only there are a file named “new_0001.exr” it doesn’t work, you have to type “new_0001.exr” instead “new_####.exr”.

I don’t know if this is done on purpose or is a bug but it can create a lot of confusion.