# Unloaded Layers

**URL:** <https://forum.aousd.org/t/unloaded-layers/1220>\
**Category:** USD\
**Tags:** python, beginner\
**Created:** [February 8, 2024, 8:53pm UTC](https://forum.aousd.org/t/unloaded-layers/1220 "2024-02-08T20:53:20Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nick](https://avatars.discourse-cdn.com/v4/letter/n/f9ae1b/32.png) [@Nick](https://forum.aousd.org/u/Nick)\
**Post date:** [February 8, 2024, 8:53pm UTC](https://forum.aousd.org/t/unloaded-layers/1220/1 "2024-02-08T20:53:21Z")

</div>

I want to alert my users if a sublayer is not loaded. Is there a method to check for unloaded layers? My current approach is to walk each layer/sublayer and check if each path in layer.sublayerPaths is in the layer.GetLoadedLayers list. Looking for a more performant or existing approach.

Thanks,  
Nick

---

<div class="post-metadata">

**Author:** ![spiff](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.aousd.org/spiff/32/22_2.png) [@spiff](https://forum.aousd.org/u/spiff)\
**Post date:** [February 14, 2024, 9:12pm UTC](https://forum.aousd.org/t/unloaded-layers/1220/2 "2024-02-14T21:12:31Z")

</div>

Hi @Nick , we were wondering if by “unloaded layers” you meant (any or all of):

- layers that have errors in them that prevented them from being loaded
- layers that have been “muted” on the Stage
- are you anticipating any layers that leverage [“variable expressions”](https://github.com/PixarAnimationStudios/OpenUSD-proposals/tree/main/proposals/stage_variable_expressions) for inclusion into the stage?

Independently, are you concerned **only** with layers in the root layerStack, or also layers from “across references”?

---

<div class="post-metadata">

**Author:** ![Nick](https://avatars.discourse-cdn.com/v4/letter/n/f9ae1b/32.png) [@Nick](https://forum.aousd.org/u/Nick)\
**Post date:** [February 18, 2024, 4:50pm UTC](https://forum.aousd.org/t/unloaded-layers/1220/3 "2024-02-18T16:50:58Z")

</div>

Hey Spiff,  
My current issue is layers that cannot be found on disk, deleted or moved.  
Nick

---

<div class="post-metadata">

**Author:** ![spiff](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.aousd.org/spiff/32/22_2.png) [@spiff](https://forum.aousd.org/u/spiff)\
**Post date:** [February 18, 2024, 10:02pm UTC](https://forum.aousd.org/t/unloaded-layers/1220/4 "2024-02-18T22:02:23Z")

</div>

The “composition engine” underneath the UsdStage keeps track of the errors it encountered while (last re-)composing the stage, including which layers it could not find. The completion of the [validation project](https://github.com/PixarAnimationStudios/OpenUSD-proposals/pull/29) we are undertaking will provide easier access to these errors.

If you are primarily interested in the missing “root layerstack” layers (which is what the technique you are currently using will give you), then after opening the stage, you should be able to get at the errors that will contain such information like (in python):

```auto
pr = stage.GetPseudoRoot()
# if root layer wasn't found then pr will be None
if pr:
    errors = pr.GetPrimIndex().rootNode.layerStack.localErrors

```
