I just read the question update (that was reverted). Here's how to do it via [Python 3.Docs]: ctypes - A foreign function library for Python:
code00.py:
#!/usr/bin/env python3
import sys
import ctypes
from ctypes import wintypes
KLF_ACTIVATE = 0x00000001
def main():
locale_id_bytes = b"00000409"
klid = ctypes.create_string_buffer(locale_id_bytes)
user32_dll = ctypes.WinDLL("user32")
kernel32_dll = ctypes.WinDLL("kernel32")
LoadKeyboardLayout = user32_dll.LoadKeyboardLayoutA
LoadKeyboardLayout.argtypes = [wintypes.LPCSTR, wintypes.UINT]
LoadKeyboardLayout.restype = wintypes.HKL
GetLastError = kernel32_dll.GetLastError
GetLastError.restype = wintypes.DWORD
klh = LoadKeyboardLayout(klid, KLF_ACTIVATE)
print("{0:s} returned: 0x{1:016X}".format(LoadKeyboardLayout.__name__, klh))
print("{0:s} returned: {1:d}".format(GetLastError.__name__, GetLastError()))
if __name__ == "__main__":
print("Python {0:s} {1:d}bit on {2:s}\n".format(" ".join(item.strip() for item in sys.version.split("\n")), 64 if sys.maxsize > 0x100000000 else 32, sys.platform))
main()
print("\nDone.")
Output:
[cfati@CFATI-5510-0:e:\Work\Dev\StackOverflow\q048287040]> "e:\Work\Dev\VEnvs\py_064_03.07.03_test0\Scripts\python.exe" code00.py
Python 3.7.3 (v3.7.3:ef4ec6ed12, Mar 25 2019, 22:22:05) [MSC v.1916 64 bit (AMD64)] 64bit on win32
LoadKeyboardLayoutA returned: 0x0000000004090409
GetLastError returned: 0
Done.
More (topic related) details on [MS.Docs]: LoadKeyboardLayoutA function.