The manual should do a better job of clarifying the distinction between “nodePath” and “NodePath”. See, “NodePath” is a class name. The symbol “nodePath” is not a class name, and might therefore be any ordinary variable, presumably an instance of the NodePath class.
So when the manual says:
it means to create an instance of a NodePath class and store it in a variable called nodePath (or the name of your choosing). Then you can call find() on that instance. And find() does accept a string, by the way, but when you try to call find() on a class, instead of an instance, Python gets mad and prints a confusing error message about the wrong parameters passed to the function.
Your code looks like its calling .find from the NodePath class instead of a NodePath instance. Try render.find() instead, or substitute render with another nodepath if you know where to start the search from.
thank you both for your replies. That’s precisely the silly mistake I knew I had to be making.
This raises a related question, though…
The manual says that this find() function will return an empty NodePath if it can’t find a match. …How do I represent that in code? In other words, how do I test to see if nodePath is empty? I can’t seem to find any resource to read about that kind of assertion.
Tonightslastsong, please note that the naming of the NodePath instance in the page you mentionned has been changed to myNodePath to make it consistent with the page named “Schene graph manipulation” earlier in that section.