# How to stop \_LoadLibModules at runtime

**URL:** <https://forum.aousd.org/t/how-to-stop-loadlibmodules-at-runtime/2751>\
**Category:** Build and Deployment\
**Created:** [October 26, 2025, 8:21pm UTC](https://forum.aousd.org/t/how-to-stop-loadlibmodules-at-runtime/2751 "2025-10-26T20:21:23Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![anderslanglands](https://avatars.discourse-cdn.com/v4/letter/a/ecccb3/32.png) [@anderslanglands](https://forum.aousd.org/u/anderslanglands)\
**Post date:** [October 26, 2025, 8:21pm UTC](https://forum.aousd.org/t/how-to-stop-loadlibmodules-at-runtime/2751/1 "2025-10-26T20:21:23Z")

</div>

I have a library that links against USD that is then wrapped in Python (but does not itself use the USD python bindings). When I import my library into a python process I get warnings from USD for each module like:

```auto
Warning: in _LoadLibModules at line 329 of /tmp/rez-cook/usd/25.08/pxr/base/tf/scriptModuleLoader.cpp -- Error loading lib ar's module 'pxr.Ar':
ModuleNotFoundError: No module named 'pxr'

...

Warning: in _LoadLibModules at line 329 of /tmp/rez-cook/usd/25.08/pxr/base/tf/scriptModuleLoader.cpp -- Error loading lib work's module 'pxr.Work':
ModuleNotFoundError: No module named 'pxr'

```

is there a way I can stop this from happening without completely disabling python support in the original USD build (in the general case I can’t control the build of the USD libraries I’m linking against)

---

<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:** [October 27, 2025, 10:44pm UTC](https://forum.aousd.org/t/how-to-stop-loadlibmodules-at-runtime/2751/2 "2025-10-27T22:44:20Z")

</div>

Short answer is you can’t stop \_LoadLibModules from being called in a python-initialized process without disabling python in the OpenUSD build.

To determine if the errors are unexpected and what you might do about them, can you say what your platform is, what flavor OpenUSD build you did (and expect going forward, i.e. static/dynamic, monolithic or not), and whether the OpenUSD build has been relocated from where it was originally installed by the build?

---

<div class="post-metadata">

**Author:** ![anderslanglands](https://avatars.discourse-cdn.com/v4/letter/a/ecccb3/32.png) [@anderslanglands](https://forum.aousd.org/u/anderslanglands)\
**Post date:** [October 27, 2025, 11:00pm UTC](https://forum.aousd.org/t/how-to-stop-loadlibmodules-at-runtime/2751/3 "2025-10-27T23:00:08Z")

</div>

Thanks Spiff. I guess I could use TfErrorMark etc to explicitly swallow those (and probably parse them to not ignore other errors that might have happened during init).

I think they’re expected - I’m not using the same python that USD was built against, so adding USD’s python modules to PYTHONPATH would be a bad idea.
