# Import other libraries in HLA

**URL:** <https://discuss.saleae.com/t/import-other-libraries-in-hla/1486>\
**Category:** Support\
**Created:** [March 11, 2022, 11:56am UTC](https://discuss.saleae.com/t/import-other-libraries-in-hla/1486 "2022-03-11T11:56:55Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![aslakrin](https://avatars.discourse-cdn.com/v4/letter/a/8797f3/32.png) [@aslakrin](https://discuss.saleae.com/u/aslakrin)\
**Post date:** [March 11, 2022, 11:56am UTC](https://discuss.saleae.com/t/import-other-libraries-in-hla/1486/1 "2022-03-11T11:56:55Z")

</div>

Hi,

I am trying to import some libraries in the HLA. Easily accomplished, or so I thought, by

1. Putting a `lib` folder next to my script
2. `pip install -r requirements.txt --target lib`
3. `sys.path.append(str(Path( __file__ ).parent.absolute() / 'lib'))`

And it is in fact easily accomplished. But the trouble apparently starts when the module I import wants to import something else. It seems all second level imports fail.

```auto
HighLevelAnalyzer.py", line 21, in <module>
    from construct import Struct

  File "C:\Program Files\Logic\resources\windows\pythonlibs\lib\site-packages\saleae\_module_space.py", line 244, in load_module
    self._inner_loader.exec_module(module)

  File "C:\project\lib\construct\ __init__.py", line 22, in <module>
    from construct.core import *

```

As you can see it could apparently find `lib/construct/ __init__.py` but that’s when it gets amnesia.

My investigation came to a stop when I found `Program Files\Logic\resources\windows\pythonlibs\lib\site-packages\saleae\_module_space.py` and realize you somehow are doing this on purpose.

The tip at [Third party libraries with HLAs - #5 by bruff](https://discuss.saleae.com/t/third-party-libraries-with-hlas/595/5) seems to be what I tried above, but that is a couple years old now.

Is there any way I can successfully import things? I don’t really care how much extra boilerplate I need so long as it works in the end.

Best regards

---

<div class="post-metadata">

**Author:** ![markgarrison](https://yyz2.discourse-cdn.com/flex030/user_avatar/discuss.saleae.com/markgarrison/32/23_2.png) [@markgarrison](https://discuss.saleae.com/u/markgarrison)\
**Post date:** [March 12, 2022, 12:13am UTC](https://discuss.saleae.com/t/import-other-libraries-in-hla/1486/2 "2022-03-12T00:13:07Z")

</div>

Hi @aslakrin, we’ve done some testing internally, and it looks like it should work if you move your lib directory outside of the extension. Sorry for the trouble!

---

<div class="post-metadata">

**Author:** ![aslakrin](https://avatars.discourse-cdn.com/v4/letter/a/8797f3/32.png) [@aslakrin](https://discuss.saleae.com/u/aslakrin)\
**Post date:** [March 24, 2022, 10:54am UTC](https://discuss.saleae.com/t/import-other-libraries-in-hla/1486/3 "2022-03-24T10:54:33Z")

</div>

Thanks that works perfectly! Didn’t see an email notification so didn’t think to check back until now.

Discovered “reload sources” does not reload the libraries, but can live with that.
