I have created a PointerProperty so that I can specify a target object that I want a my script to act on, but I can't seem to find any information about how to actually use the pointer property once I have it.

I have created the property in the register() function:

bpy.types.Scene.targetObject = PointerProperty(type=bpy.types.Object)

And I'm drawing it successfully in my tool's control panel:

tool panel

But how do I actually operate on the selected object? ie:

# throws error "AttributeError: 'tuple' object has no attribute 'name'

1 Answer 1


bpy.types.Scene has a property targetObject that is a PointerProperty. That means instances of bpy.types.Scene have a property targetObject that is a bpy.types.Object (or None).

# This prints the targetObject for the current scene
  • $\begingroup$ Got it, thanks! $\endgroup$
    – Stef
    Commented Apr 3, 2021 at 20:57

You must log in to answer this question.

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