[prev in list] [next in list] [prev in thread] [next in thread] 

List:       qgis-user
Subject:    [Qgis-user] pyqgis - external module issues
From:       andrea antonello via QGIS-User <qgis-user () lists ! osgeo ! org>
Date:       2023-03-29 14:49:29
Message-ID: CACck5jO1EVhR2+n0+USV9Sw=qWMfCOSO96ZbdjHre5xThd1wAA () mail ! gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


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

[Attachment #5 (text/html)]

<div dir="ltr">Hello,<div>I am trying to work in the scripting editor with two \
modules.</div><div>Assume I have a main.py script and a mylibrary.py in the same \
folder.<br></div><div><br></div><div>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.</div><div><br></div><div>This is  what I am experiencing when \
trying to work with the mylibrary from the main script:</div><div><br></div><div>* \
sometimes (or maybe always), it the mylibrary module is run, then in the main module \
the import doesn&#39;t seem to be needed, as if the functions defined in the \
mylibrary were held somewhere in a stack</div><div>* 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</div><div>* sometimes mylibrary can&#39;t be seen \
(module does not exist), but after a few restarts it does \
work</div><div><br></div><div>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.</div><div><br></div><div>Does anyone have a good idea for me or see \
what I am missing?</div><div>Thanks a ton,</div><div>Andrea</div></div>



_______________________________________________
QGIS-User mailing list
QGIS-User@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic