Confused with chained Python script when creating data block I recently dived into Python Blender scripting, while reading the Blender API some Python script got me stuck, I couldn't understand it, I can make it work though, here is the code from Blender API,
# Create new object with our light datablock.
light_object = bpy.data.objects.new(name=&quot;New Light&quot;, object_data=light_data)

The line bpy.data.objects.new(), Why 'data' can be chained after bpy? I'm sure 'bpy' is the module name, is '.data' and '.object' a method returning 'self' or is it a class name?
The menu said the 'bpy.data' is type of 'bpy.types.BlendData', I can not wrap my head around for this Python syntax, can you shed some light on what type of each section of the code really is so I can use the right term to search the syntax
Although I don't understand what you're doing, I know that the approach you're doing throws an error. If you go to the default scripting widow, at the bottom left it shows all the API calls you have done so if you shift+a&gt;light&gt;point, it will show
bpy.ops.object.light_add(type='POINT', radius=1, align='WORLD', location=(0, 0, 0))

And sure enough, if we run it it will create a light.