Is there a way to share functions or even constants like PI in way that avoid me of writing it up in every shader I make ?
I asked essentially the same question some time ago and got no response. I don't think this is possible in Godot 3, but the #include statement in Godot 4 may do the trick:
#include
https://github.com/godotengine/godot-proposals/issues/944