How to pass the current WebDriver element to a keyword?

I want to login using a Keyword like this:

WebUI.openBrowser('<URL>')
CustomKeywords.'methods.QAfunc.login'(driver, email, password)
WebUI.closeBrowser()

Inside the login keyword I will fill in the credentials something like this:

@Keyword
public static void login(WebDriver driver, String email, String password){
        //Insert user email
        driver.sendKeys('testObject', <EMAIL>);
    
        //Insert user password
        driver.sendKeys('testObject', <PASSWORD>); 
       
        //Click 'login'
        driver.click('testObject');        
} 

Is there a way to do that?

You can refer to this page: https://forum.katalon.com/discussion/2255/how-to-get-the-current-instance-of-webdriver-is-there-any-methodkeyword-like-getdriver

Thank you

I still can’t use saved test objects inside my keywords…
Any idea of doing so?

@Zarashima the link you provided is broken!. can you provide an answer to this…? I have the same need and cant seem to get a clear answer… In my case a have a table object that I want to pass to a custom keyword.
the custom keyword will scan the dynamic table and look for particular values on certain cells.

Custom Keywords are just Java/Groovy methods:

@Keyword
public void scanTable(TestObject myTable) {
    // some code to scan the table...
}