What is a bpy_struct?

Hi!
I think the title is clear. A bpy_struct is often asked as an argument in the blender python api. How do we get this information and what does it represent? When i realise that i need to provide this information, i never know what to do. Please, just a little help.

Thank you for any clues.

It refers to the common structure that all blender types in bpy.types are based on. It has its own API page:

http://www.blender.org/documentation/blender_python_api_2_55_0/bpy.types.bpy_struct.html

It is not an actual type that you could create yourself, but whenever it is needed, you can pass any object of the types listed in the “subclasses” section on that page, i.e. pretty much any blender data.

The (slightly not so technical) reason for its existence is most probably that the actual C-code that the blender structures are defined in needs a common starting point for all data that it exposes to the scripting API, and bpy_struct is it.

I guess it means that you need to pass an actual object as an argument (most probably of the correct type for the function) rather than a name or number. I got this error a load of times when I was mistakenly passing object names, lists or indices.

So if i understand well, in (for example) bpy.types.Menu, then Menu would be the bpy_struct? And it would not work with all methods that asks for a bpy_struct, but only the ones compatible with Menu? I’ll look at it.

Thank you for both of you. I am new to python and the blender api, so this info is very usefull.