It's been a while, so I may be completely off.
But files in the same folder are in the same namespace.
If you need something outside of the normal folder structure, it's possible to load a compiled bytecode file.
It's also possible to load text from a file, or anywhere, and compile it in real time.
I'm recalling from work on a game engine 12ish years ago. So it may even be easier now.
I'm also recalling that it's possible to create your own loader that determines the rules of where to find classes.
IIRC you could make it so your code above works, but not sure it's worth the effort.
Alrighty now my head hurts from digging that deep into past projects.
We're a place where coders share, stay up-to-date and grow their careers.
It's been a while, so I may be completely off.
But files in the same folder are in the same namespace.
If you need something outside of the normal folder structure, it's possible to load a compiled bytecode file.
It's also possible to load text from a file, or anywhere, and compile it in real time.
I'm recalling from work on a game engine 12ish years ago. So it may even be easier now.
It's not in the same folder.
customclass
is in a folder below the package.Like this:
I'm also recalling that it's possible to create your own loader that determines the rules of where to find classes.
IIRC you could make it so your code above works, but not sure it's worth the effort.
Alrighty now my head hurts from digging that deep into past projects.