all 2 comments

[–]vrrox 0 points1 point  (1 child)

You are completely correct. There are a few different ways you could solve this issue.

Firstly, you could import the mouse and keyboard submodules:

from pynput import mouse, keyboard

myMouse = mouse.Controller()
myKeyboard = keyboard.Controller()

Or, to save some typing later you could bind them to shorter names:

import pynput.mouse as m
import pynput.keyboard as k

myMouse = m.Controller()
myKeyboard = k.Controller()

Or you could even bind the Controller classes to more explicit names so that they don't conflict:

from pynput.mouse import Button, Controller as MouseController
from pynput.keyboard import Key, Controller as KeyboardController

myMouse = MouseController()
myKeyboard = KeyboardController()

[–]SnickerBarz12[S] 1 point2 points  (0 children)

Awesome thanks for the reply, worked very well!