The issue is caused by changes in Databricks Runtime 18.x that make importing a plain.py file from the notebook’s folder unreliable on job compute, even though the same pattern still works consistently on a personal DEV cluster. In 18.x, the folder that contains your notebook (and WidgetUtil.py) is no longer consistently added to Python’s sys. path for jobs, so import WidgetUtils sometimes works and sometimes fails, even though the file is present and readable.
Explicitly add the module folder to sys. path
Use this when you want minimal structural changes and a fast fix.
import os import sys
module_dir = "/Workspace/Shared/prod_utils" i
f module_dir not in sys.path:
sys.path.insert(0, module_dir)
import WidgetUtil