Here is how I fixed my problem:
in the .spec file, added the missing app module in hiddenimports:
hiddenimports=["app"]
Then to compile the executable, I run the .spec file instead or the .py file.
pyinstaller --onefile test.spec
My code (test.py) looks like this (simplified):
from app.utils import conversion 
(code) 
When I try to make an executable using PyInstaller, the .exe works when I import generic modules. However, I get the following error message when I use ''from app.utils import conversion'' at the beginning of my code:
ModuleNotFoundError: No module named 'app' 
and the .exe won't run.
My project is structured this way (simplified):
project/app/test.py 
project/app/utils/conversion.py 
The instruction I put in the console is:
pyinstaller --onefile test.py 
Any idea why and how to overcome this? Thanks!
ModuleNotFoundError: No module named 'x' because can't find the module folder, PyInstaller