Setup script does not find local module when running with --script flag in panel serve

When trying to run a setup script (that contains a global scheduler callback) with panel serve --serve I face a ERROR: No module named 'dataloader' where ‘dataloader’ is the name of a custom module I wrote in the same folder as and where the panel serve is being called from. I thought it was because the might show a different directory when called, but using something as simple as os.getcwd() revealed it was indeed in the same directory as even when the server launch was attempted.

If anyone has an idea, what may be the issue here I would greatly appreciate it.