I have a class which implements EventSubscriberInterface. It is registered in the services.yml of my module. From a function in this class, I want to be able to add a different class implementing EventSubscriberInterface as a subscriber.

I've tried using the following:

$dispatch = new EventDispatcher();
$dispatch->addSubscriber(new MyOtherClass());

That doesn't give me any errors, but it doesn't seem to do anything.
Can anybody help me?