Sendkeys is not working in a Test Case when I call it as a function in a different Test case

Make sure you have imported the Keys class:

import org.openqa.selenium.Keys as Keys

And, more importantly, make sure you read this next post – trying to figure out what you are doing from a screenshot that is inconveniently cropped right at the point of the relevant error message is not the kind of thing I normally have any patience for: