Templater - tp.file.create_new() errors out; won't create new file

Problem I’m trying to solve

I am using the Templater plugin. I am trying to create a file module that will create new Obsidian notes, based on a specific template, using the <% tp.file.create_new() %> but everything I’ve tried results in the same console log error Template parsing error, aborting. tp.file.create_new is not a function.

Things I have tried

I’m down to the very basics now; just trying to get Templater to create a new note then iterate on that, but can’t get past the error that says create_new is not a function. I have a template with the following code:

<% (await tp.file.create_new("ec", tp.date.now())+"_ec").basename _%>

What I’m trying to do

“ec” is a template that I have in my templates folder.
I’m trying to name the newly created file by cat’ing the date with “_ec”.

I am following along with the Templater docs at “The Templater site”, and one thing jumps out at me in the following Warning, but I cannot determine if it is applicable to what I’m trying to do:

Warning : if you use this option, since commands are executed asynchronously, the file can be opened first and then other commands are appended to that new file and not the previous file.

It’s undoubtedly something simple that i’m overlooking; I’d be very appreciative if anybody can point me to a workaround.

1 Like

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