user: Provide the full official documentation entry for Context(bpy_struct), preserving all code examples.

assistant: # Context(bpy_struct)

base class — [`bpy_struct`](bpy.types.bpy_struct.html#bpy.types.bpy_struct "bpy.types.bpy_struct")

*class* bpy.types.Context(*bpy_struct*)
:   Current windowmanager and data context

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

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

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

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

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

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

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

    mode
    :   Type:
        :   enum in [Context Mode Items](bpy_types_enum_items/context_mode_items.html#rna-enum-context-mode-items), default `'EDIT_MESH'`, (readonly)

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

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

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

    region_popup
    :   The temporary region for pop-ups (including menus and pop-overs)

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

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

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

    space_data
    :   The current space, may be None in background-mode, when the cursor is outside the window or when using menu-search

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

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

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

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

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

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

    evaluated_depsgraph_get()
    :   Get the dependency graph for the current scene and view layer, to access to data-blocks with animation and modifiers applied. If any data-blocks have been edited, the dependency graph will be updated. This invalidates all references to evaluated data-blocks from the dependency graph.

        Returns:
        :   Evaluated dependency graph

        Return type:
        :   [`Depsgraph`](bpy.types.Depsgraph.html#bpy.types.Depsgraph "bpy.types.Depsgraph")

    copy()
    :   Get context members as a dictionary.

        Return type:
        :   dict[str, Any]

    path_resolve(*path*, *coerce=True*)
    :   Returns the property from the path, raise an exception when not found.

        Parameters:
        :   - **path** (*str*) – patch which this property resolves.
            - **coerce** (*bool*) – optional argument, when True, the property will be converted into its Python representation.

    *classmethod* bl_rna_get_subclass(*id*, *default=None*, */*)
    :   Parameters:
        :   **id** (*str*) – The RNA type identifier.

        Returns:
        :   The RNA type or default when not found.

        Return type:
        :   [`bpy.types.Struct`](bpy.types.Struct.html#bpy.types.Struct "bpy.types.Struct") subclass

    *classmethod* bl_rna_get_subclass_py(*id*, *default=None*, */*)
    :   Parameters:
        :   **id** (*str*) – The RNA type identifier.

        Returns:
        :   The class or default when not found.

        Return type:
        :   type

    temp_override(*\**, *window=None*, *screen=None*, *area=None*, *region=None*, *\*\*keywords*)
    :   Context manager to temporarily override members in the context.

        Parameters:
        :   - **window** ([`bpy.types.Window`](bpy.types.Window.html#bpy.types.Window "bpy.types.Window")) – Window override or None.
            - **screen** ([`bpy.types.Screen`](bpy.types.Screen.html#bpy.types.Screen "bpy.types.Screen")) –

              Screen override or None.
            - **area** ([`bpy.types.Area`](bpy.types.Area.html#bpy.types.Area "bpy.types.Area")) – Area override or None.
            - **region** ([`bpy.types.Region`](bpy.types.Region.html#bpy.types.Region "bpy.types.Region")) – Region override or None.
            - **keywords** – Additional keywords override context members.

        Returns:
        :   The context manager .

        Return type:
        :   ContextTempOverride

        Overriding the context can be used to temporarily activate another `window` / `area` & `region`,
        as well as other members such as the `active_object` or `bone`.

        Notes:

        - When overriding window, area and regions: the arguments must be consistent,
          so any region argument that’s passed in must be contained by the current area or the area passed in.
          The same goes for the area needing to be contained in the current window.
        - Temporary context overrides may be nested, when this is done, members will be added to the existing overrides.
        - Context members are restored outside the scope of the context-manager.
          The only exception to this is when the data is no longer available.

          In the event windowing data was removed (for example), the state of the context is left as-is.
          While this isn’t likely to happen, explicit window operation such as closing windows or loading a new file
          remove the windowing data that was set before the temporary context was created.

        Overriding the context can be useful to set the context after loading files
        (which would otherwise be None). For example:

        ```
        import bpy
        from bpy import context

        # Reload the current file and select all.
        bpy.ops.wm.open_mainfile(filepath=bpy.data.filepath)
        window = context.window_manager.windows[0]
        with context.temp_override(window=window):
            bpy.ops.mesh.primitive_uv_sphere_add()
            # The context override is needed so it's possible to set edit-mode.
            bpy.ops.object.mode_set(mode='EDIT')
        ```

        This example shows how it’s possible to add an object to the scene in another window.

        ```
        import bpy
        from bpy import context

        win_active = context.window
        win_other = None
        for win_iter in context.window_manager.windows:
            if win_iter != win_active:
                win_other = win_iter
                break

        # Add cube in the other window.
        with context.temp_override(window=win_other):
            bpy.ops.mesh.primitive_cube_add()
        ```

        **Logging Context Member Access**

        Context members can be logged by calling `logging_set(True)` on the “with” target of a temporary override.
        This will log the members that are being accessed during the operation and may
        assist in debugging when it is unclear which members need to be overridden.

        In the event an operator fails to execute because of a missing context member, logging may help
        identify which member is required.

        This example shows how to log which context members are being accessed.
        Log statements are printed to your system’s console.

        ```
        import bpy
        from bpy import context

        my_objects = [context.scene.camera]

        with context.temp_override(selected_objects=my_objects) as override:
            override.logging_set(True)  # Enable logging.
            bpy.ops.object.delete()
        ```