Is it actually possible to write an extension with multiple controllers that will work automatically on all sites? What i want is an extension that would call controller A when site A is opened, controller B when site B is opened and so on.
I saw here https://docs.typo3.org/typo3cms/extensions/news/ that multiple controllers is possible with FlexForms and switchableControllerActions. The thing is, when i add the plugin to the site, i have to specify which controller should work for this site. I want the configuration directly in the extension and not from typo3 backend.
I know i can use the page id and call the function based on it but i'm trying to avoid it and search for better solution.
Sure this is possible. You need to use FlexForms here which is basically XML based field in your tt_content record. Thus you can configer your plugin directly your content record. Typically used for setting limit to records, sorting, etc. But also for setting any allowed controller->action combination, where the first one is default. Just have a look at some of the well know extensions how they use it. Here is a little abstract fore the relavant part of the FlexForm:
As said you can define any controller / action combination such as MyProduct->index or MyCustomer->list etc.
In order use the FlexForm you need to register it in the ext_tables.php