Compile time module discovery and import in haxe

I am trying to make a command line tool like powershell except its too limited to commands. I plan to store each command related file in a separate module because the commands are going to be niche and long. The file structure should look something like:

Main.hx
commands/
    SomeModule.hx
    OtherModule.hx

So I want something like a macro that will discover such modules and get a class that has the same name as filename inside the module file. For example, the class called SomeModule inside SomeModule.hx.

I am okay with any form of solution to this, I just want the classes inside modules inside the folder, without requiring to update Main.hx or similar files everytime a file is added or deleted, similar to minecraft mods, if youre familiar with.
I could not find any result in google so I came here.

So In the end, assuming the file structure is like below, I would like to call a static method on all of them.

Main.hx
commands/
    SomeModule.hx
    OtherModule.hx

In theory it should expand from something like:

DiscoverAndAdd(); // -> Macro call

to something like:

SomeModule.hello();
OtherModule.hello();

Thanks

We have like 10 different implementations of something similar in our unit tests. Here’s an example which should help you get started: https://github.com/HaxeFoundation/haxe/blob/development/tests/display/src/Macro.hx#L53-L76

This generates new FileThatWasFound(), but that’s easy to change to a static call.

I appreciate your help but that is too complex for my tiny brain. Can you please give a more simpler and self explanatory version?
Thanks