Import python module

classic Classic list List threaded Threaded
1 message Options
jan-3 jan-3
Reply | Threaded
Open this post in threaded view

Import python module

Hello LibO devs,

I have problems importing a python module.

Context: The main python script is in the folder [my home
named ""
Also in this folder, I placed another python file ( which
I want to import into, using "import qdahelpers"

System: Ubuntu 16.04 with LO 5.3

What happens: The main script appears in the Tools/Macros/Run Macro…
dialog (the script to be imported, too). If I run the main Test_embed
via the dialog I get the following message:

> A Scripting Framework error occurred while running the Python script|src|$Run_Test_embed?language=Python&location=user.
> Message: <class 'ImportError'>: No module named 'qdahelpers'
>   File "/usr/lib/libreoffice/program/", line 998, in getScript
>     mod = self.provCtx.getModuleByUrl( fileUri )

Is it not possible to import python files in this way when using them in
Libreoffice? Or is the file executed in another context than the folder
it resides in? If yes, is there a way how I can import nevertheless?

Kind Regards,
LibreOffice mailing list
[hidden email]