'My keyboard messes up after executing my code (PYTHON)

For my code I am using the import keyboard, and after I execute the code, my keyboard thinks the ctrl key is pressed down and I need to press Control again for it to realize that the key isn't pressed down.

For example when I press 'A' (without really pressing on control), it selects all (like 'Ctrl + A'), or when I press 'F', it shows me the find in page thing (like 'Ctrl + F').

Just to clarify, after I execute my code, my keyboard does this stuff that I wrote here in every program.

Example for my code:

import keyboard
keyboard.press('Control+S')
keyboard.write('Hello')
keyboard.press('enter')

I run this code on google, this part of code saves an image, names it 'Hello', and then presses enter to download it.



Sources

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

Source: Stack Overflow

Solution Source