Custom app Python module import

How does Frappe resolve Python imports from modules within the custom app?

I have created an utility script file … /app/app/custom/ to host common function to use within my app, how do I make Frappe see it? My IDE successfully resolves all of the import chain, but when I try to use an imported function in a script (for example, report script), I get client-side error like this:

The scripted report itself is working if I inline the imported function.

Okay, I found the solution.

Use resolved imports and simply remove top-level module which is app name.

from import helper
from app.custom.utils import helper

1 Like