Problem with initialization when running enhanced input being called once

I verified that 2111115 is output when the project starts in enhanced input, but there is a variable that becomes None when called immediately after starting. Is there a way to make it so that it is called only when a key is pressed?