I would load to QGIS map a vector layer from processing script. I'm trying to use QgsProject.instance().addMapLayer(layer)
.
It works if I run the code from pyqgis console:
layer=QgsVectorLayer('fileName.shp',"name","ogr")
if not layer.isValid():
print('layer failed to load')
QgsProject.instance().addMapLayer(layer)
but it cannot works if I run the same from processing script. No error alerts are shown.