[Solved] Error when accessing node by name from `app.NodeName`

python

(Nico Orrù) #1

I am looking for a way to reference existing node from python inside the GUI (script editor). From the examples/documentation, I extracted the following:

from NatronGui import *
app = natron.getInstance(0)
writer= app.createNode("fr.inria.openfx.WriteOIIO")

Nice! A node named “Write5” appears on the Node Graph, but when I try to get it later from another script…

app.render(app.Write5, 1,1, 1)
AttributeError: 'NatronEngine.App' object has no attribute 'Write5'

So this is the documented way, but doesn’t work. What’s the actual way to access an existing node by name?


(Nico Orrù) #2

I found the solution in section 2.2 of the user manual. The app1 variable is pre-declared and it contains the reference to the node I was looking for:

app1.render(app1.Write5, 1,1, 1)