You could guard it.
__init__.py
:
_GUARD_SOME_UTILITY_FUNCTION = True
from .utilities import SomeUtilityFunction
utilities.py
:
def SomeUtilityFunction():
if not _GUARD_SOME_UTILITY_FUNCTION:
raise SomeException("Helpful error message")
Take this with a grain of salt, as I'm typing this on my phone and haven't actually tried it.
Alternatively there's the import-guard
package on PyPI. No idea if it's any good, though. Just something a quick search brought up.
Edit:
Ok, I tried my suggestion and it doesn't work.