# Get the macro file path

**URL:** https://discourse.paraview.org/t/get-the-macro-file-path/8085
**Category:** ParaView Support
**Created:** [September 27, 2021, 8:50am UTC](https://discourse.paraview.org/t/get-the-macro-file-path/8085 "2021-09-27T08:50:05Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![Azrael3000](https://discourse.paraview.org/user_avatar/discourse.paraview.org/azrael3000/32/7648_2.png) [@Azrael3000](https://discourse.paraview.org/u/Azrael3000)
#### Post date: [September 27, 2021, 8:50am UTC](https://discourse.paraview.org/t/get-the-macro-file-path/8085/1 "2021-09-27T08:50:05Z")

</div>

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
