Get the path for a scripted module

Hi all,
I load a scripted module to Slier by adding the module path to ‘Edit / Application settings’.
I want to access the path of this module in my .py file because I want to load other files to Slicer in that path without stating again. Does anyone know how to get the path of my already loaded module in python console?
Thanks!

You can use scriptPath = os.path.dirname(os.path.abspath(__file__)) anywhere in the file. In the widget class, there is a convenience method to get full path to a resource file: self.resourcePath('UI/mycustomfile.txt').

To add these additional files to the extension’s installation package, you need to store the files in the module’s Resources subfolder and add the files to MODULE_PYTHON_RESOURCES list in CMakeLists.txt.

2 Likes