Use templater API

This seems to be the correct incantation of tp, but it does depend on Templater having run at least once before in your vault since the last startup of Obsidian.

So try inserting some random template somewhere in your vault, and then check this code again. If it now works, this issue is what has happened to you. To avoid it in the further, there is a simple trick of making an empty template, and set that template as a startup template for Templater when you restart your Obsidian. That way, it would always give the current functions object its value needed for accessing the Templater API from other places.

4 Likes