kenny_hero
New Contributor III

I have a related question.

I'm new to Databricks platform. I struggle with PYTHONPATH issue as the original poster raised. I understand using sys.path.append(...) is one approach for notebook. This is acceptable for ad-hoc interactive session, but this doesn't feel right for python module. Suppose I have multiple python modules that need to import a custom module, like the hello.py in the OP's example. I must have sys.path.append(...) line in every module before I import hello.py?

To give an example, let's say I have an utility python module that's a base of other custom modules. Then I have to remember to do sys.path.append(...) before every import. Worse part is if I forget sys.path.append(...), import works in local dev(because most IDE provides a way to set PYTHONPATH to project root) but import fails only after I deploy bundle later.

I feel there must be a way to ensure consistent behavior programmatically without explicit path setting.