zulul123 Posted April 11, 2023 Share Posted April 11, 2023 Hi. Trying to split up my script into multiple classes but getting null pointer error when trying to access methods from a different class like in this example: public class Main extends Script { Test test = new Test(); @Override public void onStart() throws InterruptedException { test.exchangeContext(getBot()); } @Override public int onLoop() throws InterruptedException { test.testLog(); return 256; } @Override public void onExit() throws InterruptedException {} } public class Test extends MethodProvider { TestTwo testTwo = new TestTwo(); public void testLog() { testTwo.logFromTestTwo(); } } public class TestTwo extends MethodProvider { public void logFromTestTwo() { log("Test Two"); } } Quote Link to comment Share on other sites More sharing options...
Gunman Posted April 11, 2023 Share Posted April 11, 2023 2 hours ago, zulul123 said: public class Test extends MethodProvider { TestTwo testTwo = new TestTwo(); public void testLog() { testTwo.logFromTestTwo(); } } Need to exchange context with testTwo as well 1 Quote Link to comment Share on other sites More sharing options...
Khaleesi Posted April 11, 2023 Share Posted April 11, 2023 Either pass the Methodprovider object to the other class or exchangeContext 1 Quote Link to comment Share on other sites More sharing options...
zulul123 Posted April 12, 2023 Author Share Posted April 12, 2023 i see, tyvm 1 Quote Link to comment Share on other sites More sharing options...