Hard to tell without seeing your code. It seems you execute your function inside the QGIS python console but if not you have to add the processing path to your python path. Such as : "/path/to/qgis/processing/share/qgis/python/plugins"
Kanash