I saw that it was possible using a sampler2D with a noise texture
A shader is not a texture. You cannot assign a shader as parameter of another shader in this way. You can make your shader render to a viewport and then assign the
How can I save a shader in a form that would be reusable in this case ?
Unfortunately it is not possible to use functions from another shader inside a new shader. This is sometimes supported in other engines by using a form of
#include so the same code can be re-used (like a fancy copy/paste), which was proposed but never added so far ( https://github.com/godotengine/godot/pull/17797 ).
At the moment the only way is to move your code into functions and copy them across all shaders where you want to use them.