working outside of application context – Flask November 16, 2023 by Tarik Maybe you need to call your function inside an application context: with app.app_context(): # call your method here