I wanted to draw this Object selector layout using Python Script and Retrive the Selected Object Also Apply the Modifier to Selected Object
I have Tried this from the another question asking for same thing but that is not working
import bpy
class Test_PT_layout_panel(bpy.types.Panel):
bl_label = "Prop Panels"
bl_category = "Test Panel"
bl_space_type = 'PROPERTIES'
bl_region_type = 'WINDOW'
bl_context = "output"
def draw(self, context):
layout = self.layout
string_property = PointerProperty(type=bpy.types.Object)
col = layout.column()
col.prop(scene, "string_property", context.scene, "objects")
def register():
bpy.utils.register_class(Test_PT_layout_panel)
def unregister():
bpy.utils.unregister_class(Tests_PT_layout_panel)
if __name__ == "__main__":
register()

col.prop_search(scene, "string_property", context.scene, "objects")orcol.prop(scene, "pointer_property")(note the difference, coding is about attention to detail) Btw define your pointer property in the register method. The draw method is for drawing UI. – batFINGER Nov 25 '19 at 12:03bpy.types.Scene.string_property = bpy.props.PointerProperty(type=bpy.types.Object)toregister()andcol.prop(scene, "string_property")to yourdraw()method @Rakeshchoudhary – brockmann Nov 25 '19 at 12:06