Loading/Creating textures from Images in Code

Godot Version

4.3_Stable

Question

I am trying to load a PNG from my res as an ImageTexture in an AtlasTexture for a TileSetAtlasSource for a TileMapLayer through code. I can load the image just fine, but for some reason the name and paths are inaccessible when i add it as an AtlasSource in code. below is the snippet I am conused about:

Image img = Image.LoadFromFile($"{testPicPath}/{name}");
AtlasTexture aTex = new AtlasTexture();
aTex.Atlas = ImageTexture.CreateFromImage(img);
aTex.Atlas.ResourceName = name;
aTex.Atlas.ResourcePath = $"{testPicPath}/{name}";
GD.Print($"{name}: {aTex.Atlas.GetName()} from {aTex.Atlas.GetPath()}");
tsas.Texture = aTex;
tsas.TextureRegionSize = tileSize;
GD.Print($"\t{((AtlasTexture)tsas.Texture).GetName()} from {tsas.Texture.GetPath()}");

for (int x = 0; x * tileSize.X < tsas.Texture.GetSize().X; x ++) {
	for (int y = 0; y * tileSize.Y < tsas.Texture.GetSize().Y; y ++) {
		tsas.CreateTile(new Vector2I(x, y));
	}
}

ts.AddSource(tsas);

...
atlasTexName[i] = $"{i}: {((TileSetAtlasSource)ts.GetSource(i)).Texture.GetName()}; {((TileSetAtlasSource)ts.GetSource(i)).Texture.GetPath()}; {((TileSetAtlasSource)ts.GetSource(i)).Texture.GetMetaList().ToString()}";

the first Print works as intended, but from the second and on, they all return blank. Am I not accessing the resource correctly? I can’t tell if it’s being set or not, and I need to load/access multiple sources for the same TileSet, which I was hoping to do through names.

EDIT: answered on reddit