[Qgis-user] pyqgis - external module issues

andrea antonello andrea.antonello at gmail.com
Wed Mar 29 07:49:29 PDT 2023


Hello,
I am trying to work in the scripting editor with two modules.
Assume I have a main.py script and a mylibrary.py in the same folder.

In the system settings I made sure to add the said folder to the PYTHONPATH
in prepend mode in order to be able to find the mylibrary upon import.

This is what I am experiencing when trying to work with the mylibrary from
the main script:

* sometimes (or maybe always), it the mylibrary module is run, then in the
main module the import doesn't seem to be needed, as if the functions
defined in the mylibrary were held somewhere in a stack
* sometimes, and that is the worst, if a function in mylibrary has been
changed, there is no way to make the main script reference the new version.
Somewhere in memory the old version of the function sticks and is not
overwritten
* sometimes mylibrary can't be seen (module does not exist), but after a
few restarts it does work

It is well possible that I am missing some configuration or proper way of
doing things, but I could not find anything related to it in the docs.

Does anyone have a good idea for me or see what I am missing?
Thanks a ton,
Andrea
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20230329/c240e965/attachment.htm>


More information about the QGIS-User mailing list