Thanks Dan !
Well, it’s embarrassing. I’ve just created a new test file. I did (nearly) the same things. And then everything works.
… I have been struggling too many hours for this, and you just showed me there is nothing to worry about.
Note that the layer using the function is a shape layer … I will try to solve this tomorrow … and I’ll let you know …
But I am really glad : I will be using (a sort of) global functions …