Can I make a function callable from BP without it being a member of an inherited class

What I’ve got is:

UCLASS()
class MY_UNREAL_PROJECT_API MainLoop
{
GENERATED_BODY();
public:
UFUNCTION(BlueprintCallable)
void mainLoop();
}

And on compiling I get either (depending on which macros are put in):

  1. MainLoop is not a class or namespace name
  2. Class MainLoop must inherit from UObject

What you can do is create a blueprint library which makes a bridge to call your class’ functions if you don’t want it to be a UObject.
Other than that, it must be an UObject to have interaction with Blueprint VM.