I'm working on a lib for PS5 DualSense controller, based on dualsense_controller. I want to import it in my python program and somehow pass event's from this lib. from time import sleep from dualsense_controller import DualSenseController class DS5: def __init__(self, controller_nb=0, debug = False): ''' ''' # list availabe devices and throw exception when tzhere is no device detected device_infos = DualSenseController.enumerate_devices() if len(device_infos) < 1: raise Exception('No DualSense Controller available.') # flag, which keeps program alive self.is_running = True self.debug = debug self.controller = DualSenseController(device_index_or_device_info=device_infos[controller_nb]) self.register_callbacks() # enable/connect the device self.controller.activate() def register_callbacks(self): # register the button callbacks self.controller.btn_cross.on_down(self.on_cross_btn_pressed) self.controller.btn_cross.on_up(self.on_cross_btn_released) # register the error callback self.controller.on_error(self.on_error) # callback, when cross button is pressed, which enables rumble def on_cross_btn_pressed(self): if self.debug == True: print('cross button pressed') # callback, when cross button is released, which disables rumble def on_cross_btn_released(self): if self.debug == True: print('cross button released') def __exit__(self): self.controller.deactivate() if __name__ == "__main__": Ds5 = DS5(debug=True) while Ds5.is_running: sleep(0.001) So when for example button is pressed, it's going to execute some method in that program. Any ideas? Thanks in advance. Continue reading...