vault.getAbstractFileByPath keeps returning null and I'm unsure why

So I’m working on a plugin, and one of the things I’d like to do is to load files from a folder.
I have done this in the past for another plugin, but it does not work for this one. This is how I’m trying to get the contents, but folder is null whenever I add any folder besides the root. I have tried folder, folder/, /folder, /folder/, none of them work.
I am calling the function below in the plugin’s onLoad() function

	async updateMultiLineSnippets() {
		const files: TFile[] = [];
		const path = "/9.ZK-management/"; // DEBUG: don't use the settings.multilineFolder for now
		const folder =;
		console.log("Folder:", folder);

		if (folder instanceof TFolder) {
			folder.children.forEach((f) => {
				if (f instanceof TFile) {

it works when I use “/” as the path

but when I set the path to/9.ZK-management/, it returns null, even though it the folder definitely exists

This happens on both 0.14.5 and 0.14.8 of obsidian.

I have found the problem. It is because I was calling it from onLoad(). Switching to onLayoutReady for the call fixed it.