<div dir="ltr"><div>Hi, </div><div>I am trying to create a tool that chains together some algorithms. Normally I would just use the graphical modeler but one of the tools I want to chain together is Tin Interpolation that doesn't seem to work well with the modeler. </div><div>I have gotten it to work by setting up what I can in the modeler and then exporting and modifying a python script. </div><div>One thing that I can't seem to get to work is the input field for the interpolation plugin. It appears to need the field index. </div><div>I can get the field index if I have the file path but when I use the Vector Layer Parameter like this:  </div><div><b>self.addParameter(QgsProcessingParameterVectorLayer('Elevationpoints', 'Elevation_points', types=[QgsProcessing.TypeVectorAnyGeometry], defaultValue=None))</b></div><div><b><br></b>This seems to return the layer ID rather than the path. Something like this:<br><b>'Elevationpoints_ad0ce945_8f93_4e0e_8fe7_5b053ef287dd'</b><br><br></div><div>In the console I get the correct result if I run script this with the path-<br><br><b>vlayer = QgsVectorLayer('C:\Elevationpoints.shp')<br>index = vlayer.fields().lookupField('Lidar')<br>print(index)</b><br>But if I try to use the layer ID from the console or the script GUI I get -1 meaning the field was not found.<br>And if I run dataprovider() it says the layer doesn't have a data provider. </div><div><br>How can I get the field index from the layer ID?<br></div><div><br></div><div>I also posted this question on stack exchange.</div><a href="https://gis.stackexchange.com/questions/379502/index-of-field-layer-where-i-have-the-layer-id-pyqgis-3">https://gis.stackexchange.com/questions/379502/index-of-field-layer-where-i-have-the-layer-id-pyqgis-3</a><div><br></div><div>Thanks for the help!</div><div>-Bas</div></div>