Run helper methods from plugins/index.php in controller

So I am currently upgrading an old kirby 2 project to kirby 3 and I noticed that the helpermethods I defined in plugins/index.php cannot be run in the controllers of templates anymore. I was wondering what is the best practice to ensure these can be run in the controllers. The defined methods should be available for all controllers.

plugins/index.php:

<?php

function test() {
    echo "Hi there";
} 

controllers/{{template}}.php:

return function ($args) {

    test(); // error: "Call to undefined function test()"

  return {{returnArray}};
};

I appreciate the help.

Kind regards,

You have to put your index.php into a folder, not directly into the plugins folder

Yeah… I feel stupid now :sweat_smile:

Thanks for the solution