You can cast your own modules into your function by loading them into the lib folder located in the same folder as your function.
However, in the context of OpenCV, this is not a supported scenario at the moment. The default version of Python used in the Azure Function environment is Python 2.7. If you try to execute function code using OpenCV for Python 2.7, the error message you get will look like the following:
2016-11-07T20:47:33.151 Function completed (Failure, Id=42fa9d38-05f1-46d4-a8ce-9fbaa24a870d) 2016-11-07T20:47:33.166 Exception while executing function: Functions.ImageProcessor. Microsoft.Azure.WebJobs.Script: ImportError: numpy.core.multiarray failed to import Traceback (most recent call last): File "D:\home\site\wwwroot\ImageProcessor\run.py", line 17, in <module> import cv2 ImportError: numpy.core.multiarray failed to import
The fix for this is to upgrade the version of numpy used by Python 2.7 , but you cannot upgrade yourself.
As you noted, Python support for Azure functions is in an experimental phase right now. These issues will be addressed when Python is fully integrated as a first-class language.
Ling toh
source share