Import other libraries in HLA


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.", line 21, in <module>
    from construct import Struct

  File "C:\Program Files\Logic\resources\windows\pythonlibs\lib\site-packages\saleae\", line 244, in load_module

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

As you can see it could apparently find lib/construct/ 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\ and realize you somehow are doing this on purpose.

The tip at Third party libraries with HLAs - #5 by bruff 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

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!

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.