Re: [QGIS-Developer] Multiple python scripts in python console?

2023-05-05 Thread Yoann Quenach de Quivillic via QGIS-Developer
Hi Raymond Note that this should work "out of the box" starting from QGIS 3.32 (cf https://github.com/qgis/QGIS/pull/51912) Le ven. 5 mai 2023 à 14:50, Raymond Nijssen via QGIS-Developer < qgis-developer@lists.osgeo.org> a écrit : > Hi Klaus, > > Thank you so much, it works!! > > Replying to

Re: [QGIS-Developer] Multiple python scripts in python console?

2023-05-05 Thread Raymond Nijssen via QGIS-Developer
Hi Klaus, Thank you so much, it works!! Replying to you and the dev list, hoping this solution will end up in the same thread. Kind regards, Raymond On 05-05-2023 12:52, Klaus Affeldt wrote: Hi Raymond, can't write to the list yet, so i answer you directly: The python console has a

Re: [QGIS-Developer] Multiple python scripts in python console?

2023-05-04 Thread Etienne Trimaille via QGIS-Developer
> For example, a newly defined function on the class was > unknown in script_1. Might be a bug, but I'm not even sure. Well, for me it works without any issue. But you need to re-execute the script_2.py in the Python console, it will refresh the class definition in the Python console context then

Re: [QGIS-Developer] Multiple python scripts in python console?

2023-05-04 Thread Raymond Nijssen via QGIS-Developer
Hi Etienne, Already tried what you are describing. Indeed it's inconvenient, and sometimes the changes in the class code did not end up in the class definition. For example, a newly defined function on the class was unknown in script_1. Might be a bug, but I'm not even sure. So the best way

Re: [QGIS-Developer] Multiple python scripts in python console?

2023-05-04 Thread Etienne Trimaille via QGIS-Developer
If you are talking about the simple Python console panel, and loading Python files from there, then you can skip the " from .script_2 import TestClass". If you notice, when you launch the script_2.py, you have a generated line similar to : exec(Path('/tmp/tmp5g244g4w.py').read_text()) So it's

[QGIS-Developer] Multiple python scripts in python console?

2023-05-04 Thread Raymond Nijssen via QGIS-Developer
Hi developers, While writing a python script in the QGIS python console editor I needed to write a new class and for convenience I put that in its own python file. Both files are in the same directory, but I cannot import my class in the other script. Here's an example: # script_1.py