Modify Image by Pixel Coordinates At Runtime

Godot Version

Godot 4.3

Question

I want to be able to modify an image by a specific pixel and then update the Sprite2D that it is connected to.
I tried to create an Image and use Image.set_pixel(), but this only changed the png after I closed the window.
How do I do this in Godot 4.3?

You can use the mentioned set_pixel-method you just have to call the following afterwards:

my_image.set_pixel(...)
my_sprite.texture = ImageTexture.create_from_image(my_image)