How do you make one of these "file open" things in Python?

I’m working on an add-on in Python and was looking for an example of how to implement one of these “file open” controls:


Can anyone provide an example of how to implement this?

Thanks!

Edit: Ignore the “Attached Images” picture below – I want something that allows the user to open an image like in the Image node shown above, not a material in the Material tab.

Attachments


that is a template_ID(), which requires a RNA PointerProperty, which you can’t create with python.

You can use a StringProperty() of subtype=‘FILE_PATH’, which will add a file browser button. The property will store that path.

Terrific – thank you!