How can I call python method from Jinja2

Hi all,

I want to call python function from jinja2.

Is there a way that we can call python function in jinja2 ?

1 Like

What you mean ? From where ? like from a doctype method? a whitelisted method ?

Generally and not related to current frappe structure, Yes you can with app.jinja_env.globals.update(your_function=your_function . You have to update context_processor to be available .

@kickapoo

Yes I want to call doctype method from print format using jinja2

1 Like

I will check it and post you later but in general {{ doc }} is available.

Basically when I am free I will try this first: