Get the macro file path

Hi,
I have a Python script that is located in the Macros folder (which can be either: ~/config/ParaView/Macros, ../Macros/ (relative to the ParaView “executable”, see below), or part of $PV_MACRO_PATH)

Now this script loads in some additional files which are relative to this file (in this case a subfolder). Now the question is how to figure out where the macro file is located. The normal __file__ does not work (NameError: name '__file__' is not defined).

The usual workaround with inspect.getsourcefile(lambda: None) returns <string> so that does not help either.

Is there any way to get the file path of the macro that is currently being executed?

Alternatively, is it possible to get the path of the current ParaView executable? In my case I have it symlinked, so it should be the location of the symlink and not the actual executable. As the above mentioned ../Macros path is relative to the symlink and not the executable.

Thanks in advance,
Arno