What is the bug or the crash?
Adding a new feature using PyQGIS - does not apply the "Reuse last entered value" - either from a feature created using pyqgis, or a feature created using the built in digitisation tools.
Steps to reproduce the issue
- Create a vector layer, (point in this case), with an attribute. Set the attribute form to "Reuse last entered value" in the attribute form settings. (also added a default value attribute to test that functionality also works)
- Add a feature using
geometry = QgsGeometry.fromPointXY(QgsPointXY(x, y))
feat = QgsVectorLayerUtils.createFeature(layer, geometry, {}, layer.createExpressionContext() )
- Default value applied to that one, entered a value for the "reuse value" attribute.
- Add another feature, "reused value" is not applied to that attribute in the 2nd feature.
Versions
| QGIS version | 3.40.11-Bratislava |
| QGIS code revision | df059ed19c |
| |
| Libraries |
| Qt version | 5.15.13 |
| Python version | 3.12.11 |
| GDAL version | 3.11.3 (Compiled) 3.11.4 (Running) — Eganville |
| PROJ version | 9.6.2 (Compiled) 9.7.0 (Running) |
| EPSG Registry database version | v12.022 (2025-08-30) |
| GEOS version | 3.13.1-CAPI-1.19.2 |
| SQLite version | 3.50.4 |
| PDAL version | 2.9.0 |
| PostgreSQL client version | unknown |
| SpatiaLite version | 5.1.0 |
| QWT version | 6.3.0 |
| QScintilla2 version | 2.14.1 |
| OS version | Windows 10 Version 2009 |
| |
| Active Python plugins |
| AnotherDXF2Shape | 1.3.2 |
| Auto_save | 1.0 |
| changeDataSource | 3.1 |
| e_tracability | 0.7 |
| FreehandRasterGeoreferencer | 0.8.3 |
| html_table_exporter | 0.2.0 |
| magic_map_loader | 1.2 |
| quick_map_services | 1.1.0 |
| slyr_community | 6.0.0 |
| splitmultipart | 1.0.0 |
| StreetView | 3.3 |
| theme_manager | 1.0 |
| TomBio | 3.4.4 |
| what3words | 4.4 |
| db_manager | 0.1.20 |
| grassprovider | 2.12.99 |
| MetaSearch | 0.3.6 |
| processing | 2.12.99 |
Supported QGIS version
New profile
Additional context
No response
What is the bug or the crash?
Adding a new feature using PyQGIS - does not apply the "Reuse last entered value" - either from a feature created using pyqgis, or a feature created using the built in digitisation tools.
Steps to reproduce the issue
Versions
3.11.4 (Running) — Eganville
9.7.0 (Running)
Supported QGIS version
New profile
Additional context
No response