In the QGIS Python console there is code completion available since a while (see here). However it seems to be quite limited as to its range, according to the doc the following libs are supported:

Code completion, highlighting syntax and calltips for the following APIs: 
- Python
- PyQt5
- QScintilla2
- osgeo-gdal-ogr

Obviously this makes coding directly within QGIS cumbersome, especially if one is used to the comfort-level of modern IDEs. I configured pyCharm to reflect the QGIS environment, so that it knows how to autocomplete on qgis.core and so on, but copying and pasting code from a secondary IDE is circumstancial.

Is there a way to have auto-completion on imported libs (e.g. os or math) directly within the QGIS console/editor?

I can confirm that I get auto-completion suggestions only for basic python and the abovementioned libs.

here code completion suggests some tings (for auto)

For (even very basic) imported libs (e.g. math or os) this doesn't work:

but e.g. for the imported math lib I have no code completion

  • 1
    Are you aware that you can connect the Python console to an external editor? Click the Show Editor button at the top of the Python console and then click the Open In External Editor button at the top of the script editor pane. See this post.
    – Matt
    Commented Jan 23, 2023 at 11:57
  • I am aware, yes. However as far as I see that just is another way of copying and pasting, as I'm still switching between windows to debug (instead of just pressing Ctrl+E in the QGIS Script Editor or simply coding in the console directly, I would code in pyCharm, save, then execute from QGIS Script Editor or copy and paste to console). I know, first world problems - I'm looking for a convenient PyQGIS dev workflow while maintaining the WYSIWYG-aspect of working directly in QGIS. Improving on the IDE capacities of QGIS would be the easiest.
    – Honeybear
    Commented Feb 1, 2023 at 14:17


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.