<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /></head><body style='font-size: 10pt; font-family: Verdana,Geneva,sans-serif'>
<p>Hi,</p>
<p>I am trying to fix some Python code that worked before, but not anymore due to API changes in master meanwhile.</p>
<p>I am getting a reference to a layer by name and then want to query the 'pendingFields'. Here is the code I use:</p>
<p>---------------------</p>
<p>LayerParcels= QgsProject.instance().layerStore().mapLayersByName('Parcels')[0]</p>
<p>newParcel = QgsFeature()</p>
<p><span>newParcel </span>.setFields(<span>LayerParcels</span>.pendingFields())</p>
<p>-------------------------</p>
<p>The first two lines seem to work, but the third line triggers an error:</p>
<p>AttributeError: 'QgsVectorLayer' object has no attribute 'pendingFields'</p>
<p>Why is that?</p>
<p>This code worked a few weeks before and the 'pendingFields' - according to <a href="https://qgis.org/api/classQgsVectorLayer.html">https://qgis.org/api/classQgsVectorLayer.html</a> still exists?</p>
<p>What is wrong with my code?</p>
<p>Thanks for any hints!</p>
<p>Andreas</p>
<p><br /></p>

</body></html>