user: Show practical ways to work with Basic Object Operations Example in a Blender add-on or script – include code.

assistant: This script demonstrates basic operations on object like creating new
object, placing it into a view layer, selecting it and making it active.

```
import bpy

view_layer = bpy.context.view_layer

# Create new light data-block.
light_data = bpy.data.lights.new(name="New Light", type='POINT')

# Create new object with our light data-block.
light_object = bpy.data.objects.new(name="New Light", object_data=light_data)

# Link light object to the active collection of current view layer,
# so that it'll appear in the current scene.
view_layer.active_layer_collection.collection.objects.link(light_object)

# Place light to a specified location.
light_object.location = (5.0, 5.0, 5.0)

# And finally select it and make it active.
light_object.select_set(True)
view_layer.objects.active = light_object
```

base classes — [`bpy_struct`](bpy.types.bpy_struct.html#bpy.types.bpy_struct "bpy.types.bpy_struct"), [`ID`](bpy.types.ID.html#bpy.types.ID "bpy.types.ID")

*class* bpy.types.Object(*ID*)
:   Object data-block defining an object in a scene

    active_material
    :   Active material being displayed

        Type:
        :   [`Material`](bpy.types.Material.html#bpy.types.Material "bpy.types.Material")

    active_material_index
    :   Index of active material slot

        Type:
        :   int in [0, inf], default 0

    active_selection_set
    :   Index of the currently active selection set

        Type:
        :   int in [-inf, inf], default 0

    active_shape_key
    :   Current shape key

        Type:
        :   [`ShapeKey`](bpy.types.ShapeKey.html#bpy.types.ShapeKey "bpy.types.ShapeKey"), (readonly)

    active_shape_key_index
    :   Current shape key index

        Type:
        :   int in [-32768, 32767], default 0

    add_rest_position_attribute
    :   Add a “rest_position” attribute that is a copy of the position attribute before shape keys and modifiers are evaluated

        Type:
        :   boolean, default False

    animation_data
    :   Animation data for this data-block

        Type:
        :   [`AnimData`](bpy.types.AnimData.html#bpy.types.AnimData "bpy.types.AnimData"), (readonly)

    animation_visualization
    :   Animation data for this data-block

        Type:
        :   [`AnimViz`](bpy.types.AnimViz.html#bpy.types.AnimViz "bpy.types.AnimViz"), (readonly, never None)

    bound_box
    :   Object’s bounding box in object-space coordinates, all values are -1.0 when not available

        Type:
        :   float multi-dimensional array of 8 \* 3 items in [-inf, inf], default ((0.0, 0.0, 0.0), (0.0, 0.0, 0.0), (0.0, 0.0, 0.0), (0.0, 0.0, 0.0), (0.0, 0.0, 0.0), (0.0, 0.0, 0.0), (0.0, 0.0, 0.0), (0.0, 0.0, 0.0)), (readonly)

    collision
    :   Settings for using the object as a collider in physics simulation

        Type:
        :   [`CollisionSettings`](bpy.types.CollisionSettings.html#bpy.types.CollisionSettings "bpy.types.CollisionSettings"), (readonly)

    color
    :   Object color and alpha, used when the Object Color mode is enabled

        Type:
        :   float array of 4 items in [0, inf], default (1.0, 1.0, 1.0, 1.0)

    constraints
    :   Constraints affecting the transformation of the object

        Type:
        :   [`ObjectConstraints`](bpy.types.ObjectConstraints.html#bpy.types.ObjectConstraints "bpy.types.ObjectConstraints") [`bpy_prop_collection`](bpy.types.bpy_prop_collection.html#bpy.types.bpy_prop_collection "bpy.types.bpy_prop_collection") of [`Constraint`](bpy.types.Constraint.html#bpy.types.Constraint "bpy.types.Constraint"), (readonly)

    cycles
    :   Cycles object settings

        Type:
        :   `CyclesObjectSettings`, (readonly)

    data
    :   Object data

        Type:
        :   [`ID`](bpy.types.ID.html#bpy.types.ID "bpy.types.ID")

    delta_location
    :   Extra translation added to the location of the object

        Type:
        :   [`mathutils.Vector`](mathutils.html#mathutils.Vector "mathutils.Vector") of 3 items in [-inf, inf], default (0.0, 0.0, 0.0)

    delta_rotation_euler
    :   Extra rotation added to the rotation of the object (when using Euler rotations)

        Type:
        :   [`mathutils.Euler`](mathutils.html#mathutils.Euler "mathutils.Euler") rotation of 3 items in [-inf, inf], default (0.0, 0.0, 0.0)

    delta_rotation_quaternion
    :   Extra rotation added to the rotation of the object (when using Quaternion rotations)

        Type:
        :   [`mathutils.Quaternion`](mathutils.html#mathutils.Quaternion "mathutils.Quaternion") rotation of 4 items in [-inf, inf], default (1.0, 0.0, 0.0, 0.0)

    delta_scale
    :   Extra scaling added to the scale of the object

        Type:
        :   [`mathutils.Vector`](mathutils.html#mathutils.Vector "mathutils.Vector") of 3 items in [-inf, inf], default (1.0, 1.0, 1.0)

    dimensions
    :   Absolute bounding box dimensions of the object.
        Warning: Assigning to it or its members multiple consecutive times will not work correctly, as this needs up-to-date evaluated data

        Type:
        :   [`mathutils.Vector`](mathutils.html#mathutils.Vector "mathutils.Vector") of 3 items in [-inf, inf], default (0.0, 0.0, 0.0)

    display
    :   Object display settings for 3D viewport

        Type:
        :   [`ObjectDisplay`](bpy.types.ObjectDisplay.html#bpy.types.ObjectDisplay "bpy.types.ObjectDisplay"), (readonly, never None)

    display_bounds_type
    :   Object boundary display type

        - `BOX`
          Box – Display bounds as box.
        - `SPHERE`
          Sphere – Display bounds as sphere.
        - `CYLINDER`
          Cylinder – Display bounds as cylinder.
        - `CONE`
          Cone – Display bounds as cone.
        - `CAPSULE`
          Capsule – Display bounds as capsule.

        Type:
        :   enum in [`'BOX'`, `'SPHERE'`, `'CYLINDER'`, `'CONE'`, `'CAPSULE'`], default `'BOX'`

    display_type
    :   How to display object in viewport

        - `BOUNDS`
          Bounds – Display the bounds of the object.
        - `WIRE`
          Wire – Display the object as a wireframe.
        - `SOLID`
          Solid – Display the object as a solid (if solid drawing is enabled in the viewport).
        - `TEXTURED`
          Textured – Display the object with textures (if textures are enabled in the viewport).

        Type:
        :   enum in [`'BOUNDS'`, `'WIRE'`, `'SOLID'`, `'TEXTURED'`], default `'TEXTURED'`

    empty_display_size
    :   Size of display for empties in the viewport

        Type:
        :   float in [0.0001, 1000], default 1.0

    empty_display_type
    :   Viewport display style for empties

        Type:
        :   enum in [Object Empty Drawtype Items](bpy_types_enum_items/object_empty_drawtype_items.html#rna-enum-object-empty-drawtype-items), default `'PLAIN_AXES'`

    empty_image_depth
    :   Determine which other objects will occlude the image

        Type:
        :   enum in [`'DEFAULT'`, `'FRONT'`, `'BACK'`], default `'DEFAULT'`

    empty_image_offset
    :   Origin offset distance

        Type:
        :   float array of 2 items in [-inf, inf], default (-0.5, -0.5)

    empty_image_side
    :   Show front/back side

        Type:
        :   enum in [`'DOUBLE_SIDED'`, `'FRONT'`, `'BACK'`], default `'DOUBLE_SIDED'`

    field
    :   Settings for using the object as a field in physics simulation

        Type:
        :   [`FieldSettings`](bpy.types.FieldSettings.html#bpy.types.FieldSettings "bpy.types.FieldSettings"), (readonly)

    hide_probe_plane
    :   Globally disable in planar light probes

        Type:
        :   boolean, default False

    hide_probe_sphere
    :   Globally disable in spherical light probes

        Type:
        :   boolean, default False

    hide_probe_volume
    :   Globally disable in volume probes

        Type:
        :   boolean, default False

    hide_render
    :   Globally disable in renders

        Type:
        :   boolean, default False

    hide_select
    :   Disable selection in viewport

        Type:
        :   boolean, default False

    hide_surface_pick
    :   Disable surface influence during selection, snapping and depth-picking operators. Usually used to avoid semi-transparent objects to affect scene navigation

        Type:
        :   boolean, default False

    hide_viewport
    :   Globally disable in viewports

        Type:
        :   boolean, default False

    image_user
    :   Parameters defining which layer, pass and frame of the image is displayed

        Type:
        :   [`ImageUser`](bpy.types.ImageUser.html#bpy.types.ImageUser "bpy.types.ImageUser"), (readonly, never None)

    instance_collection
    :   Instance an existing collection

        Type:
        :   [`Collection`](bpy.types.Collection.html#bpy.types.Collection "bpy.types.Collection")

    instance_faces_scale
    :   Scale the face instance objects

        Type:
        :   float in [0.001, 10000], default 1.0

    instance_type
    :   If not None, object instancing method to use

        - `NONE`
          None.
        - `VERTS`
          Vertices – Instantiate child objects on all vertices.
        - `FACES`
          Faces – Instantiate child objects on all faces.
        - `COLLECTION`
          Collection – Enable collection instancing.

        Type:
        :   enum in [`'NONE'`, `'VERTS'`, `'FACES'`, `'COLLECTION'`], default `'NONE'`

    is_from_instancer
    :   Object comes from a instancer

        Type:
        :   boolean, default False, (readonly)

    is_from_set
    :   Object comes from a background set

        Type:
        :   boolean, default False, (readonly)

    is_holdout
    :   Render objects as a holdout or matte, creating a hole in the image with zero alpha, to fill out in compositing with real footage or another render

        Type:
        :   boolean, default False

    is_instancer
    :   Type:
        :   boolean, default False, (readonly)

    is_shadow_catcher
    :   Only render shadows and reflections on this object, for compositing renders into real footage. Objects with this setting are considered to already exist in the footage, objects without it are synthetic objects being composited into it.

        Type:
        :   boolean, default False

    light_linking
    :   Light linking settings

        Type:
        :   [`ObjectLightLinking`](bpy.types.ObjectLightLinking.html#bpy.types.ObjectLightLinking "bpy.types.ObjectLightLinking"), (readonly, never None)

    lightgroup
    :   Lightgroup that the object belongs to

        Type:
        :   string, default “”, (never None)

    lineart
    :   Line Art settings for the object

        Type:
        :   [`ObjectLineArt`](bpy.types.ObjectLineArt.html#bpy.types.ObjectLineArt "bpy.types.ObjectLineArt"), (readonly)

    location
    :   Location of the object

        Type:
        :   [`mathutils.Vector`](mathutils.html#mathutils.Vector "mathutils.Vector") of 3 items in [-inf, inf], default (0.0, 0.0, 0.0)

    lock_location
    :   Lock editing of location when transforming

        Type:
        :   boolean array of 3 items, default (False, False, False)

    lock_rotation
    :   Lock editing of rotation when transforming

        Type:
        :   boolean array of 3 items, default (False, False, False)

    lock_rotation_w
    :   Lock editing of ‘angle’ component of four-component rotations when transforming

        Type:
        :   boolean, default False

    lock_rotations_4d
    :   Lock editing of four component rotations by components (instead of as Eulers)

        Type:
        :   boolean, default True

    lock_scale
    :   Lock editing of scale when transforming

        Type:
        :   boolean array of 3 items, default (False, False, False)

    material_slots
    :   Material slots in the object

        Type:
        :   [`bpy_prop_collection`](bpy.types.bpy_prop_collection.html#bpy.types.bpy_prop_collection "bpy.types.bpy_prop_collection") of [`MaterialSlot`](bpy.types.MaterialSlot.html#bpy.types.MaterialSlot "bpy.types.MaterialSlot"), (readonly)

    matrix_basis
    :   Matrix access to location, rotation and scale (including deltas), before constraints and parenting are applied

        Type:
        :   [`mathutils.Matrix`](mathutils.html#mathutils.Matrix "mathutils.Matrix") of 4 \* 4 items in [-inf, inf], default ((0.0, 0.0, 0.0, 0.0), (0.0, 0.0, 0.0, 0.0), (0.0, 0.0, 0.0, 0.0), (0.0, 0.0, 0.0, 0.0))

    matrix_local
    :   Parent relative transformation matrix.
        Warning: Only takes into account object parenting, so e.g. in case of bone parenting you get a matrix relative to the Armature object, not to the actual parent bone

        Type:
        :   [`mathutils.Matrix`](mathutils.html#mathutils.Matrix "mathutils.Matrix") of 4 \* 4 items in [-inf, inf], default ((0.0, 0.0, 0.0, 0.0), (0.0, 0.0, 0.0, 0.0), (0.0, 0.0, 0.0, 0.0), (0.0, 0.0, 0.0, 0.0))

    matrix_parent_inverse
    :   Inverse of object’s parent matrix at time of parenting

        Type:
        :   [`mathutils.Matrix`](mathutils.html#mathutils.Matrix "mathutils.Matrix") of 4 \* 4 items in [-inf, inf], default ((1.0, 0.0, 0.0, 0.0), (0.0, 1.0, 0.0, 0.0), (0.0, 0.0, 1.0, 0.0), (0.0, 0.0, 0.0, 1.0))

    matrix_world
    :   Worldspace transformation matrix

        Type:
        :   [`mathutils.Matrix`](mathutils.html#mathutils.Matrix "mathutils.Matrix") of 4 \* 4 items in [-inf, inf], default ((0.0, 0.0, 0.0, 0.0), (0.0, 0.0, 0.0, 0.0), (0.0, 0.0, 0.0, 0.0), (0.0, 0.0, 0.0, 0.0))

    mode
    :   Object interaction mode

        Type:
        :   enum in [Object Mode Items](bpy_types_enum_items/object_mode_items.html#rna-enum-object-mode-items), default `'OBJECT'`, (readonly)

    modifiers
    :   Modifiers affecting the geometric data of the object

        Type:
        :   [`ObjectModifiers`](bpy.types.ObjectModifiers.html#bpy.types.ObjectModifiers "bpy.types.ObjectModifiers") [`bpy_prop_collection`](bpy.types.bpy_prop_collection.html#bpy.types.bpy_prop_collection "bpy.types.bpy_prop_collection") of [`Modifier`](bpy.types.Modifier.html#bpy.types.Modifier "bpy.types.Modifier"), (readonly)

    motion_path
    :   Motion Path for this element

        Type:
        :   [`MotionPath`](bpy.types.MotionPath.html#bpy.types.MotionPath "bpy.types.MotionPath"), (readonly)

    parent
    :   Parent object

        Type:
        :   [`Object`](#bpy.types.Object "bpy.types.Object")

    parent_bone
    :   Name of parent bone in case of a bone parenting relation

        Type:
        :   string, default “”, (never None)

    parent_type
    :   Type of parent relation

        - `OBJECT`
          Object – The object is parented to an object.
        - `ARMATURE`
          Armature.
        - `LATTICE`
          Lattice – The object is parented to a lattice.
        - `VERTEX`
          Vertex – The object is parented to a vertex.
        - `VERTEX_3`
          3 Vertices.
        - `BONE`
          Bone – The object is parented to a bone.

        Type:
        :   enum in [`'OBJECT'`, `'ARMATURE'`, `'LATTICE'`, `'VERTEX'`, `'VERTEX_3'`, `'BONE'`], default `'OBJECT'`

    parent_vertices
    :   Indices of vertices in case of a vertex parenting relation

        Type:
        :   int array of 3 items in [0, inf], default (0, 0, 0)

    particle_systems
    :   Particle systems emitted from the object

        Type:
        :   [`ParticleSystems`](bpy.types.ParticleSystems.html#bpy.types.ParticleSystems "bpy.types.ParticleSystems") [`bpy_prop_collection`](bpy.types.bpy_prop_collection.html#bpy.types.bpy_prop_collection "bpy.types.bpy_prop_collection") of [`ParticleSystem`](bpy.types.ParticleSystem.html#bpy.types.ParticleSystem "bpy.types.ParticleSystem"), (readonly)

    pass_index
    :   Index number for the “Object Index” render pass

        Type:
        :   int in [0, 32767], default 0

    pose
    :   Current pose for armatures

        Type:
        :   [`Pose`](bpy.types.Pose.html#bpy.types.Pose "bpy.types.Pose"), (readonly)

    rigid_body
    :   Settings for rigid body simulation

        Type:
        :   [`RigidBodyObject`](bpy.types.RigidBodyObject.html#bpy.types.RigidBodyObject "bpy.types.RigidBodyObject"), (readonly)

    rigid_body_constraint
    :   Constraint constraining rigid bodies

        Type:
        :   [`RigidBodyConstraint`](bpy.types.RigidBodyConstraint.html#bpy.types.RigidBodyConstraint "bpy.types.RigidBodyConstraint"), (readonly)

    rotation_axis_angle
    :   Angle of Rotation for Axis-Angle rotation representation

        Type:
        :   float array of 4 items in [-inf, inf], default (0.0, 0.0, 1.0, 0.0)

    rotation_euler
    :   Rotation in Eulers

        Type:
        :   [`mathutils.Euler`](mathutils.html#mathutils.Euler "mathutils.Euler") rotation of 3 items in [-inf, inf], default (0.0, 0.0, 0.0)

    rotation_mode
    :   The kind of rotation to apply, values from other rotation modes are not used

        Type:
        :   enum in [Object Rotation Mode Items](bpy_types_enum_items/object_rotation_mode_items.html#rna-enum-object-rotation-mode-items), default `'XYZ'`

    rotation_quaternion
    :   Rotation in Quaternions

        Type:
        :   [`mathutils.Quaternion`](mathutils.html#mathutils.Quaternion "mathutils.Quaternion") rotation of 4 items in [-inf, inf], default (1.0, 0.0, 0.0, 0.0)

    scale
    :   Scaling of the object

        Type:
        :   [`mathutils.Vector`](mathutils.html#mathutils.Vector "mathutils.Vector") of 3 items in [-inf, inf], default (1.0, 1.0, 1.0)

    selection_sets
    :   List of groups of bones for easy selection

        Type:
        :   [`bpy_prop_collection`](bpy.types.bpy_prop_collection.html#bpy.types.bpy_prop_collection "bpy.types.bpy_prop_collection") of `SelectionSet`, (readonly)

    shader_effects
    :   Effects affecting display of object

        Type:
        :   [`ObjectShaderFx`](bpy.types.ObjectShaderFx.html#bpy.types.ObjectShaderFx "bpy.types.ObjectShaderFx") [`bpy_prop_collection`](bpy.types.bpy_prop