Skeleton: Cant save empty resource to path (custom import plugin)

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By majidarif

I have a custom file that contains multiple skeletons for multiple characters. I’m trying to import each as a skeleton so I can reference it to my meshes in code any time.

Here is my code:

for x in range(numChars):
	var skel =
	var skin =
	for _y in range(numCharBones[x]):
		var bonePIndex = file.get_32()
		var boneIndex  = file.get_32()
		var boneName  = "bone_%d" % boneIndex
		var bonePName = "bone_%d" % bonePIndex if bonePIndex >= 0 else ""
		var m0 = file.get_float()
		var m1 = file.get_float()
		var m2 = file.get_float()
		var m3 = file.get_float()
		var m4 = file.get_float()
		var m5 = file.get_float()
		var m6 = file.get_float()
		var m7 = file.get_float()
		var m8 = file.get_float()
		var m9 = file.get_float()
		var m10 = file.get_float()
		var m11 = file.get_float()
		var m12 = file.get_float()
		var m13 = file.get_float()
		var m14 = file.get_float()
		var m15 = file.get_float()
		var boneId = skel.find_bone(boneName)
		if bonePName != "":
			var bonePId = skel.find_bone(bonePName)
			skel.set_bone_parent(boneId, bonePId)
		skel.set_bone_rest(boneId, Transform(Vector3(m0, m1, m2), Vector3(m4, m5, m6), Vector3(m8, m9, m10), Vector3(m12, m13, m14)))
	var outpath = "res://equips/%d.%s" % [x, get_save_extension()]
	var result =, skel)
	if result != OK:
		return result

Unfortunately, I keep getting the error: Can't save empty resource to path

func get_save_extension():
	return "skel"

func get_resource_type():
	return "Skeleton"

After further investigation, I found out that Skeleton is not a resource which means it cannot be saved. What are my options here? What are my alternatives?