Or you might have to use CallSub and a WaitFor, see if it comes back with (B4XPages) object not found or similar.
There might be a "problem" that presumably your library also uses B4XPages code for when the library user is using B4XPages, and that might be enough to trick us your library into always thinking that the library user is using B4XPages.
Worst case, but probably safest and simplest solution, might be to have two versions of the library: ThaiUtils.b4xlib and ThaiUtilsB4XPages.b4xlib