Using one embedded library from another

Hi All. I have two embedded libraries and they work well separately. As I know, they are not stored as a plain test in the file system. So, how should I use one library from another?

:thinking:

→ Load Basic Libraries
Loading Libraries

Tools Library
…

Grok has offered me the decision

> def loadLibrary(lib_name: str, module_name: str = None):
>         """Add library path to sys.path and import the specified module"""
>         doc = XSCRIPTCONTEXT.getDocument()
>         url = uno.fileUrlToSystemPath(f"{doc.URL}/Scripts/python/{lib_name}")
>         if not url in sys.path:
>             sys.path.insert(0, url)
>         if module_name and not module_name in sys.modules.keys():
>             return zipimport.zipimporter(url).load_module(module_name)

It fit to me with some modification

As documented in details in online help
https://help.libreoffice.org/latest/en-US/text/sbasic/python/python_import.html?&DbPAR=BASIC&System=Unknown%20OS

3 Likes