I have been writing an addon that utilizes an imported image. So far the only way to import was to to to the UV/Image Editor and import the image. Then copy the name of the imported image to a text input in my addon. This is cumbersome and I would rather have something that looks like this:


From which I can access the image through

bpy.data.images[<image name here>]

Is this possible to do? I have only been successful in accessing the image path, but that won't work for my script.

  • $\begingroup$ It is supposed to happen in a panel? Do you need to limit it to a certain image format (based on file extension)? $\endgroup$
    – CodeManX
    Oct 15 '14 at 1:19

You can get access to the file browser in Blender by using the StringProperty with the subtype "FILE_PATH". As documented here. And example of using this would be

file_path = StringProperty(name = "File", subtype = "FILE_PATH")

Then you can just use file_path like this:

bpy.data.images.load(file_path) #most of the time you will have to do self.file_path

If you need to use that image elsewhere just set all that equal to a variable.


If you want the user to append a picture to bpy.data.images and do not need a reference to that image, you may add the operator bpy.ops.image.open() operator to a panel:


If you want to call it yourself, use


so the file selector shows up.

The widget like in your screenshot is template_ID(), but we can't really utilize it, as we can't create pointer properties to store a datablock reference in.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.