Yes, but it requires #5697 which was released this morning in PyInstaller 4.3. Now if you also add your source files as data files then FrozenImporter.get_source()
(and therefore Python’s tracebacks mechanisms) can find them.
For top level code or imports in the same folder as your top level code, it should just be a case of adding --add-data=path/to/file.py:.
(Unix) or --add-data=path/to/file.py;.
(Windows). (In both cases note the trailing dot.)
To include fully fledged packages containing an __init__.py
you’ll likely have abandon the command line and to switch over to the spec file. Edit the .spec
file generated by PyInstaller putting from PyInstaller.utils.hooks import collect_data_files
at the top then set datas=[]
to datas=collect_data_files('foo')
(replacing foo
with the real name of the library). Then rebuild using pyinstaller specfile-name.spec
.