# Python flattening stage while preserving relative paths

**URL:** <https://forum.aousd.org/t/python-flattening-stage-while-preserving-relative-paths/1476>\
**Category:** USD\
**Tags:** python\
**Created:** [April 24, 2024, 12:15pm UTC](https://forum.aousd.org/t/python-flattening-stage-while-preserving-relative-paths/1476 "2024-04-24T12:15:05Z")\
**Posts on this page:** 1\
**Showing post:** 2

<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:** [April 25, 2024, 12:25am UTC](https://forum.aousd.org/t/python-flattening-stage-while-preserving-relative-paths/1476/2 "2024-04-25T00:25:51Z")

</div>

If you are flattening a _layerStack_, have a look at [the documentation here](https://openusd.org/release/api/flatten_layer_stack_8h.html#a5f0608fd52ee0e88ba59f5349b72dea7), which explains the subtleties, default behavior, and what you can do to override it. If you are flattening an entire stage and you are not getting the same “default behavior”, then I think that’s a bug to be reported.

We haven’t considered adding the same overriding ability to Flatten/Export, but the bottom line is that in a highly referenced scene, it really doesn’t seem safe to preserve “anchored” paths when flattening. But I guess providing the escape hatch if you really know your environment, as we provide for FlattenLayerStack, might be appropriate.

---

_[View the full topic](https://forum.aousd.org/t/python-flattening-stage-while-preserving-relative-paths/1476)._
