How to change filter and repeat settings for TEXTURE via code?

Godot Version



What I want to do:

Create Sprite2Ds on the fly via GDScript, attach different textures to them, add a fragment shader (doing its thing, the actual logic works), and set filter_nearest and repeat_disable for TEXTURE (like you normally would in the editor).

Somehow I can’t get this working.

When I go by TEXTURE (default) in the shader, some pixels aren’t set properly. When I go by uniform sampler2D my_tex and access it, it seems, that this adds another texture, the shader doing it’s thing on this one, but not on TEXTURE.

How does this work? I only want one specific texture for each Sprite2D. How can you change the settings for TEXTURE?