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 app.py --serve setup_script.py I face a ERROR: No module named 'dataloader' where ‘dataloader’ is the name of a custom module I wrote in the same folder as app.py and where the panel serve is being called from. I thought it was because the setup_script.py might show a different directory when called, but using something as simple as os.getcwd() revealed it was indeed in the same directory as app.py even when the server launch was attempted.

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

Hi,
I am facing the same exact issue. It seems the setup is separated completely from the webapp’s module although I am importing within the same local path. Would appreciate the communities’ help.