Keylogger.exe and backdoor.exe with keylogger not working Python3 ethical hacking Zero to mastery course

I am taking the python3 ethical hacking zero to mastery course and when I convert my backdoor combined with my keylogger to an exe using pyinstaller --onefile --noconsole it converts to an exe but when I try to run it I get a fatal error message failed to excute script in my windows 10 machine. I think it is something to do with the keylogger because the same thing happens when I convert my keylogger to an exe using --onefile --noconsole but when I just convert it to an exe doing --onefile it works! Also the backdoor works fine when I do --onefile --noconsole without importing my keylogger. I am making sure both files are in the same directory and I have windows defender turned off. I also download both scripts from the course in case of a mistake in my script and still does not work! Can anyone please provide some insight into this?! The same thing happened with my keylogger from Zaids python ethical hacking course and I posted a topic on that too but no one has responded!! Please help!!

Write a simple python program to open a calculator in Windows (just an example) and then convert it to exe using the options. If it runs then there is some problem with the script or maybe the video’s script is older. But I am positive that it will fail to run as this problem may be a Windows 10 problem that gives an error if something is trying to hide the console while running a console related program.