Context I am working on a Python + Pyside6 application. I would like to only archive the source .ui files that are use to define the User Interface in Qt and have them compiled into .py files at build time. Current research Pyside6 comes with a tool that automatically compiles the .ui files into .py files, and that tool (pyside6-project) is automatically installed in a script directory when you install the pyside6 package. The hatchling build backend provide a nice plugin environment which allows to easily execute a Python script at build time. Problem: In my dev box, I consistently use a virtual environment (venv) per project, and I install all the dependencies for the project in that venv, so I know that the required script will be in the path. But I also know that another user could have installed the pysyde6 package in any other possible place, and that it could even not be in the current path. And I could only find in the sys module the path of the Python interpreter and the installation prefix. Question: How can I know for a Python script all the possible places where the pyside6-project program could have been installed? Continue reading...