Skip to content

@W-22468107 - support local module imports in datacustomcode run #108

Open
diksha-sf wants to merge 5 commits into
forcedotcom:mainfrom
diksha-sf:main
Open

@W-22468107 - support local module imports in datacustomcode run #108
diksha-sf wants to merge 5 commits into
forcedotcom:mainfrom
diksha-sf:main

Conversation

@diksha-sf
Copy link
Copy Markdown
Collaborator

@diksha-sf diksha-sf commented Jun 4, 2026

Importing local Python modules failed from the same directory. For example, for the below directory structure, if from utility.py we import helper_function() in entrypoint.py, it failed with ImportError: No module named 'utility'.
my_function/
|── entrypoint.py
|── utility.py

The add_py_folder() function in src/datacustomcode/run.py only added the py-files/ subdirectory to sys.path, but not the entrypoint's own directory.

Solution: Added both py-files/ (if exists) and entrypoint directory

if py_folder.exists():
   sys.path.insert(0, str(py_folder))
sys.path.insert(0, str(entrypoint_dir)) 

@diksha-sf diksha-sf changed the title @W-22468107 - Add entrypoint directory to sys.path to support local module imports @W-22468107 - support local module imports in datacustomcode run for function Jun 4, 2026
@diksha-sf diksha-sf changed the title @W-22468107 - support local module imports in datacustomcode run for function @W-22468107 - support local module imports in datacustomcode run Jun 4, 2026
@diksha-sf diksha-sf requested a review from ritaagarwala-sf June 5, 2026 07:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant