This is how Java/Groovy works; you must reference your custom keyword (your class) in either of the two following ways:
1.) Include the package name before the class name, as you’ve done (not recommended for most circumstances, see below for why):
new myMethods.SomeMethods().logIn()
2.) Import the package (this is how you should do things 99.9999…% of the time):
Add the following import statement to the top of your script:
import myMethods.SomeMethods
Then call your method the usual way:
new SomeMethods().logIn()
Note: There’s an extremely convenient way to import any packages that the script will need. Simply press ctrl + shift + o, and the studio will pull in all of the required packages based on your current code. If it finds classes in multiple different packages that share the same name, it will ask you to choose which one you want.
In reality, you should only use approach #1 when you need to use two different classes that share the same name. For example, pretend we have two custom keywords called “SomeMethods”, but they exist in different packages:
package package1
public class SomeMethods() {
public void doSomething() {
}
}
and
package package2
public class SomeMethods() {
public void doSomething() {
}
}
Then in our test case, pretend that we need to use the doSomething() method from both classes for whatever reason. Then calling new SomeMethods()
won’t work, because the compiler won’t know which SomeMethods class to use. Should it use the one defined in package1, or the one defined in package2? In this case, you should use approach #1 from above:
new package1.SomeMethods().doSomething();
new package2.SomeMethods().doSomething();
In the real world, you should rarely need to do this. If you find yourself needing to do it quite often, then it’s probably time to take a moment and rename your classes/reorganize packages.