How do I make my custom function accessible on the __main__ scope on gunicorn hosted flask server?

I am in the process of launching a staging app using a ML model I made in fast ai… The model is accessed through flask hosted on a gunicorn server and when it tries to make a prediction the following error occurs:

Can’t get attribute ‘getImages’ on <module ‘main’ from ‘/usr/local/bin/gunicorn’>"

Locally I simply declared that function in the main scope.

1 how can do that while hosting on gunicorn so I can make predicitions?

  1. How should I have built my models to avoid this issue all together? I haven’t found that much material on deployment and architecture before deployment to assist with containerization

Thank you for your time.

figured it out, had to add the following:

import __main__
def getImages(d): return##
__main__.getImages = getImages