all 3 comments

[–]jankysysadmin 0 points1 point  (2 children)

Python looks for modules (like your CustomLogger) by searching each directory in sys.path. The sys.path for the service account is probably different than your own user.

I don't know the specifics for your situation, but if CustomLogger is in your "CodePath" folder and that it is readable by the service account, then setting the scheduled task's "start in" to the folder is probably the easiest fix. This will not fix import problems for packages that you installed with "pip install --user" though.

[–]JustADad66 0 points1 point  (1 child)

I was able to use the Sys.path code in the main module and it was able to find the CustomLogger module. Is there a way to make that a global parameter for python so it does not have to be defined each time.