from qgis.core import *
from qgis.gui import *

@qgsfunction(args='auto', group='Custom')
def SUMof(value1, value2,feature,parent):
	return sum(filter(None,[f[value1] for f in QgsProject.instance().mapLayersByName(value2)[0].getFeatures()]))