I'm making an add-on located in the slidebar and I need an object picker for later on referencing that object.

For now this is what I have:

enter image description here

And I would like to add the object picker (like this):

enter image description here

This are the lines of code:

import bpy
class TestPanel (bpy.types.Panel):
bl_label = "Slime"
bl_idname = "PT_TestPanel"
bl_space_type = 'VIEW_3D'
bl_region_type = 'UI'
bl_category = 'Add Slime '

def draw (self,context):
    layout = self.layout

    row = layout.row()
    row.operator ("mesh.primitive_plane_add" ,text = 'Create cube ',icon='CUBE')
def register():


 def unregister():

if __name__ == "__main__":

1 Answer 1


With the eyedropper:

Alas, at the moment, this cannot be done. See the feature request "Make the eyedropper tool available in add-ons via Python" and the bug report that led up to it. Also, see this answer for the thread leading up to the bug report.

You may want to go to the feature request and upvote it. With only two votes it is unlikely to be done anytime soon.

Without the eyedropper:

This turns out to be easy. See this answer for an example that works with recent versions of Blender.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .