I would like to program a Raspberry Pi to take a single keyboards inputs in one USB port and then output through the Pi's two other USB ports in order to control two Macs at once with one keyboard.
I'm very new to Python. Which functions and commands do I need in order to program this function to my Pi?
I've been searching for the proper command, but I came here for help.
This isn't exactly something easily done with Python. This is because you're delving into developing device drivers on your Macs' side. Please allow me to explain:
Assuming you're using Raspbian on the Raspberry Pi (a flavor of Linux, and thus a Posix system onto itself), you would need to read the appropriate /dev/tty* file which maps to your keyboard first, and then appropriately convert and write out to the appropriate /dev/usb* files. Do note, most computers also send handshakes back and forth to the USB devices (for example, to register them on their own USB busses).
To be frank, you'd probably have better luck splicing wires from your keyboard, and connecting it to another USB male-socket, and then plugging both male-socket ends into your Macs.
Raspberry Pi Keyboard Splitter