NB: I know the proper solution is just to do pip install pywin32 and let everything be done automatically, but here this question is about the internals of pythoncom.
When doing import pythoncom, it works, but:
in "C:\Python38\Lib\site-packages\pythoncom.py", there is
import pywintypes, but no pywintypes.py or .pyd or .dll is present in thesite-packagesdirectory. How can it "magically" findpywintypes?when doing
print(pythoncom.__file__), we see:'C:\\Python38\\lib\\site-packages\\pywin32_system32\\pythoncom38.dll'How is this stunning behaviour possible internally? (i.e. pythoncom.py that we imported is now recognized as another file, a .dll)
Also,
pythoncom.pycontains:# Magic utility that "redirects" to pythoncomxx.dllimport pywintypespywintypes.__import_pywin32_system_module__("pythoncom", globals())
What and where is this (I quote) "magic utility" that redirects to pythoncomxx.dll?
I don't see where this utility is called when doing just import pythoncom.