Thx, it works. I copied a line from loadimage function itself.
func showbody(i): if globals.loadimage(i.person.imagefull) != null: $Panel/bodyimage.visible = true if File.new().file_exists(i.person.imagefull.replace('bodies', 'naked')): $Panel/bodyimage.texture = globals.loadimage(i.person.imagefull.replace('bodies', 'naked')) else: $Panel/bodyimage.texture = globals.loadimage(i.person.imagefull) elif nakedspritesdict.has(i.person.unique): ...