Your indentation is off, but I'll assume that's just a copy/paste issue.
Your issue is that 'F:\\prep\\converted\\*.tif' will try to output a file called literally *.tif which won't work. You need to provide an actual file name. I suggest using os.path.join and os.path.basename
from osgeo import gdal
input_path = 'F:\\...
Here is the best solution I found up to now, however if someone has an idea on how to do it differentely or what I could do to improve the code I would appreciate it.
The Pixel-Function Code for calculating the modal value in the end is:
<VRTRasterBand dataType="Byte" band="1" subClass="VRTDerivedRasterBand">
A bit older GDAL versions required the use of -of parameter (notice: with the format name, for example -of PNG) or otherwise it used GeoTIFF as the default format. You can check your version with gdalinfo --version.
However, you have given .sid as the extension of the output file and because MrSID driver is read only then any GDAL version will use GeoTIFF ...