Hi team, I want to import some functions from util folder which is same directory of the folder in which handler.py. As files in util folder is being used by other cognite functions too, I can’t keep the files of util folder in function_folder but at the time of importing functions from files of util folder and after deploying cognite function it gives import error as
so basically structure is
Repo
function_folder- file1 and handler.py
util_folder - file2 and file 3
And I want to use methods from file 2 into handler.py
and I have added __init__.py in util folder
2025-04-04T12:17+05:30 : Traceback (most recent call last): 2025-04-04T12:17+05:30 : File "/home/site/wwwroot/function/_cognite_function_entry_point.py", line 297, in import_user_module 2025-04-04T12:17+05:30 : handler = importlib.import_module(handler_module_path) 2025-04-04T12:17+05:30 : File "/usr/local/lib/python3.9/importlib/__init__.py", line 127, in import_module 2025-04-04T12:17+05:30 : return _bootstrap._gcd_import(name[level:], package, level) 2025-04-04T12:17+05:30 : File "<frozen importlib._bootstrap>", line 1030, in _gcd_import 2025-04-04T12:17+05:30 : File "<frozen importlib._bootstrap>", line 1007, in _find_and_load 2025-04-04T12:17+05:30 : File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked 2025-04-04T12:17+05:30 : File "<frozen importlib._bootstrap>", line 680, in _load_unlocked 2025-04-04T12:17+05:30 : File "<frozen importlib._bootstrap_external>", line 850, in exec_module 2025-04-04T12:17+05:30 : File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed 2025-04-04T12:17+05:30 : File "/home/site/wwwroot/function/handler.py", line 5, in <module> 2025-04-04T12:17+05:30 : from utils.get_cognite_client import get_cdf_client 2025-04-04T12:17+05:30 : ModuleNotFoundError: No module named 'utils'
Please let me know if I am missing something