func change_sprite():
var texture = load('res://my_sprite.png')
$Sprite2D.texture = texture
But if you are a new user to the engine, it’s better to start with the Getting Started part of the documentation here Introduction — Godot Engine (stable) documentation in English it will teach you how to use the editor, the concepts of Godot, and how to structure 2 small games one in 2D and another in 3D.