As mentioned in the other post VS Code is not able to find the InputSystem namespace by default. The solution mentioned in https://forum.unity.com/threads/unityengine-inputsystem-not-found.945820/ fixed the problem for me.
- In Unity, in your script folder create a New Assembly Definition.
- Add Unity.InputSystem to the list of Assembly Definition References
I hope this helps someone else.