<div dir="ltr"><div><div><div><div><div><div>I'm trying to programmatically set a QgsLayoutPicture content in QGIS3.0:</div><div><br></div><div>1) I create a new print composition and I name it 'test'<br></div>2) I create a picture frame in the composition and I call it 'picture'<br></div>3) I run the following code:</div><div><br></div><div>from qgis.core import QgsProject<br>myLayout = QgsProject.instance().layoutManager().layoutByName('test')<br>myLayoutPicture = myLayout.itemById("picture")<br>myLayoutPicture.setPicturePath("path to an image")<br><br></div>and I get the following Exception:<br>AttributeError: 'QgsLayoutItem' object has no attribute 'setPicturePath'<br><br></div>If I inspect myLayoutPicture object I found it is a qgis._core.QgsLayoutItem not a QgsLayoutPicture<br><br></div>Is this a correct behaviour or is it an issue? How can I get the right Layout object?</div><div><br></div><div>Regards.</div><div>Enrico Ferreguti<br></div></div>