Calling Jinja Function from Custom App

I have my custom app called “finto_accounting”, I want to create custom function to be called in jinja print format.

But I get following error:

Error in print format on line 19: {{ finto_accounting.utils.money_in_words(doc.total_credit) }}
Traceback (most recent call last): 
File "apps/frappe/frappe/utils/jinja.py", line 94, in render_template return get_jenv().from_string(template).render(context) 
File "env/lib/python3.10/site-packages/jinja2/environment.py", line 1304, in render self.environment.handle_exception() 
File "env/lib/python3.10/site-packages/jinja2/environment.py", line 939, in handle_exception raise rewrite_traceback_stack(source=source) 
File "", line 1, in top-level template code 
File "env/lib/python3.10/site-packages/jinja2/sandbox.py", line 327, in getattr value = getattr(obj, attribute)
 jinja2.exceptions.
UndefinedError: 'finto_accounting' is undefined

Seems my app “finto_accounting” is not recognized by erpnext.
I confirmed that my app is installed and i restart my environment as well.

Is there any setup needed to call my function in jinja?

@oscarutomo you have to identify the function in your hooks file then call it by it’s name only.

Please check this.

1 Like

@bahaou @NCP oh…ok. noted.
i tried it and it works. Thanks both of you…