Page 1 of 1

[Solved] Including python modules in extensions

Posted: Tue Mar 29, 2016 1:16 pm
by alois
Hi,
How can I use my own python module in extensions?
When I include it in the addin package the standard python import fails ('no module named ..').
Most examples I found only use one python file and that containing multiple files use a complicated method to set the system path new but I couldn't figure out how this works.
I didn't find anything in the PyUNO wiki.

Re: Including python modules in extensions

Posted: Wed Mar 30, 2016 11:42 pm
by OlivierR
Just put your modules in the pythonpath folder of your extension.

In main.py:

Code: Select all

import mypackage
import mymodule
In your extension, it looks like this:

Code: Select all

main.py
/pythonpath/
/pythonpath/mypackage/
/pythonpath/mymodule.py

Re: Including python modules in extensions

Posted: Fri Apr 01, 2016 8:43 am
by alois
Hi,
Thanks a lot!
I knew it must be something easy.