'Detecting input from mouse and keyboard simultaneously

I am coding a (key/mouse)logger in python. I have a fully functioning mouse logger, and a full operating keylogger. Now it is time to merge it. I am using Listener from pynput and I cannot figure out how to make 2 listeners that listens at the same time, also keyboard.Listener(on_press=on_press) and mouse.Listener(on_click=on_click, on_scroll=on_scroll) as listener1: does not work. I am new to python, so I am probably missing something really simple. Can anyone help me?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source