Is it possible to import a jinja template that is located outside the app directory?

I’m using a template to render my app and I want to import another template that’s located outside the app directory (provided by another package). Is this possible?

curdoc().template accepts any Jinja2 template (either as a string or a jinja2.Template object), it does not matter how or from where you loaded it.

Thanks for the reply @Bryan !
Actually, that helped me realize that I can just add the location of the imported template to the searchpath like so:
curdoc().template.environment.loader.searchpath.append("path/to/imported/template")

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.