From this link, I have found another solution that does not use pyautogui, as pyautogui does not really well handle the different keyboards.
from pynput.keyboard import Controller
keyboard=Controller()
keyboard.type('[email protected]')
pynput is not installed by default, so you will have to install it first using:
$ pip install pynput
pyautogui stays still really useful for tasks like capturing the screen, moving the mouse, or others.