How do I reference functions inside a controller inside the controller?

What’s the proper way to call a function that’s inside of a controller? Like for example in the below, on initialize say I have some function that has a callback, and then I need to call functions that are also in the controller. (Maybe the approach is wrong?)

(() => {
	const application = Stimulus.Application.start();

	application.register("mymap", class extends Stimulus.Controller {

		customFunction() {}

         someOtherFunction() {}

         initialize() {

             // do stuff when the controller loads

            // after ajax happens, call some function inside controller					
            var something = someOtherFunction();




Okay I don’t know if this is the right way to go about it, but I found that I could reference the controller, its vars, and its functions in a third party API via:

var controller = application.getControllerForElementAndIdentifier($('[data-controller="map-interactive"]')[0], "map-interactive");

But I also read that you can bind it to a callback inside the controller like so:


I settled on the former option because the initial event must trigger when a modal opens and I’m restricted to using $.modal.OPEN.