I’ve used the tp.file.find_tfile() method from Templater to locate tFile’s so far. Today I looked at the source of Templater and found it’s definition here, and it says:
Here the normalizePath is imported from the obsidian module, so you’ll need to access that somehow. During my testing I’ve found the two following approaches produces a tFile:
I think OP is asking about how to actually open a given TFile, not how to get TFile from a string path.
(And you can access normalizePath by tp.obsidian.normalizePath. Plus, in this case we have a proper path already, so we will not need to call it. cf. About normalizePath)
To answer the original question, you can use, for example,
this.app.workspace.openLinktext(path, ""); // path: string. If you have a proper sourcePath, you don't need the full path: .openLinktext(linktext, sourcePath)
Note: Since this function takes linktext (e.g. note, folder/note.md, note#heading, folder/note.md#^block) as its first parameter, it’s
convenient for opening a specific heading or block