# Use Filebrowser in a node for the Animation-Nodes-Addon

I am working on a new node for myself for the Animation nodes Addon. I need to open a File-Browser via that node, similar with what happens in the "Bake Sound"-Node.
I looked at the code and have figured out how to add a filebrowser. What I can not figure out is how to get the path from the file browser for use in the code.

That is actually very simple because I developed a system to simplify tasks like this one.

You just have to call the invokePathChooser function in your drawing code and give it a callback (the name of the function that handles the result). AN will do the rest for your.

class MyNode(...):
# ...
def draw(self, layout):
self.invokePathChooser(layout, "setFilepath", text = "Find File")

def setFilepath(self, path):
print(path)

• So how can I get the path? I can print the variable, how can I use it in other functions? – schustudrai Apr 25 '16 at 12:31
• Well you can do whatever you want with the path in the 'setFilepath' function. Maybe you want to store the path inside the node? For that you have to create a StringProperty... – Jacques Lucke Apr 25 '16 at 14:14