Skip to content

name 'iface' is not defined #8

@leonmvd

Description

@leonmvd

I run into this issue when filtering layers (from postgis) in QGIS4:

An error has occurred while executing Python code:

NameError: name 'iface' is not defined. Did you mean: 'self.iface'?
Traceback (most recent call last):
File "/Users/leon/Library/Application Support/QGIS/QGIS4/profiles/default/python/plugins/FilterLayersAtOnce-master/filter_multiple_layers_at_once.py", line 222, in filterOnlySelectedsAtOnce
layers = iface.layerTreeView().selectedLayers()
^^^^^
NameError: name 'iface' is not defined. Did you mean: 'self.iface'?

Python version: 3.12.11 (main, Mar 4 2026, 09:38:07) [Clang 17.0.0 (clang-1700.6.4.2)]
QGIS version: 4.0.0-Norrköping Norrköping, 1ddcee3d

Python Path:
/Applications/QGIS-final-4_0_0.app/Contents/Resources/qgis/python
/Users/leon/Library/Application Support/QGIS/QGIS4/profiles/default/python
/Users/leon/Library/Application Support/QGIS/QGIS4/profiles/default/python/plugins
/Applications/QGIS-final-4_0_0.app/Contents/Resources/qgis/python/plugins
/Applications/QGIS-final-4_0_0.app/Contents/Frameworks/lib/python312.zip
/Applications/QGIS-final-4_0_0.app/Contents/Frameworks/lib/python3.12
/Applications/QGIS-final-4_0_0.app/Contents/Frameworks/lib/python3.12/lib-dynload
/Applications/QGIS-final-4_0_0.app/Contents/Frameworks/lib/python3.12/site-packages
/Users/leon/Library/Application Support/QGIS/QGIS4/profiles/default/python

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions