Keyboard not working on Login Screen
I have a MacBook Pro 13-inc having macOS Catalina 10.15.6 bought in 2015. The mac was working fine until two weeks before but later the keyboard stopped working on login screen. After starting the Mac the login screen appears and when trying to enter login password the keyboard is not responding.
I have tried rebooting by holding Cmd + Opt + p + r + Power couple of times and after trying 3-4 times keyboard starts working. However, the problem continues to happen again after shutting down the Mac.
I also gave the MacBook to the apple service and they formatted and gave it back but the problem still happens. I have not downloaded any app or extension.
Is there a way to solve this?
Thanks
MacBook Pro 13″, macOS 10.15