Is it possible to invoke a customKeyword into another customKeyword?

Hello, i have 2 different packages and each one contain a custom keyword:

  • start_app containing a custom keyword
  • close_app containing a custom keyword

After writing some logic into start_app, if there is a failure, i want to invoke the close_app to perform an operation.

How can i do this?


Yes, you can call a custom a keyword inside another custom keyword. You simply just have to use the same syntax as you would normally use to call keyword.

Example code:

package start_app
import com.kms.katalon.core.annotation.Keyword

class StartAppKeyword {
	 * Refresh browser
	def startApplication() {
		println "do something ...";
		try {
			throw new Exception("Somehow at this point an exception is thrown !");
		} catch (Throwable e) {


package stop_app
import com.kms.katalon.core.annotation.Keyword

class StopAppKeyword {
	 * Refresh browser
	def stopApplication() {
		println "do something before closing application...";

When i did like you mentioned, it underlined the word CustomKeywords as shown below:


Can you execute the test case successfully though ? Try Ctrl + Shift + O to auto import.

i did that still underline


Does the test script fail at that step ? My project has that underline too but I am still able to use the keyword.

It does not failed my testcase as well…but would be great to know the reason of this underline

Please share the entire keyword, if possible. The only reason it would be underlined would be a missing/incorrect import statement.

I already did ctrl+shift+O to import missing import but still underlying.

Try to import the needed (used) custom keyword class into the other one which is consuming it as a regular groovy/java class and use it accordingly (without Customkeyword.blah)
That should solve the ‘underline’ issue.
Have a feeling that katalon editor/intelisence engine it is now aware at the custom package level about the CustomKeyword wrapper therefore it may complain, even if the code it is compiled and running just fine
Not a big deal IMHO as long as the code it is correctly executed but it may be confusing.

i did that as well, but still underlined… as you said as long as it is working, i’ll leave it like this :slight_smile:

I tested to invoke a customKeyword into another customKeyword, it does not work.

Anyone for help?

This one work :slight_smile:

This one does not works! Please help

How about adding import statement into your start_app package (above class statement):
import CustomKeywords.''


You have this in a Keyword class source:


But CustomKeywords.''() works only in a Test Case script. You should not call…xxx() in a Groovy class under the Keywords directory.

Change it to:

1 Like

@grylion54, @kazurayam, thank you for guiding me :slight_smile: really appreciated.