Skip to content

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

Merged
diksha-sf merged 3 commits into
forcedotcom:mainfrom
diksha-sf:u/diksha2/run
Jun 15, 2026
Merged

@W-22468107 - support local module imports in datacustomcode run#115
diksha-sf merged 3 commits into
forcedotcom:mainfrom
diksha-sf:u/diksha2/run

Conversation

@diksha-sf

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

Copy link
Copy Markdown
Collaborator

Problem

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))

Additional changes

  • Fixed toml file to include pipreqs as a build (dev) dependency instead of runtime dependency

Testing

Tested by using sdk commands - init, scan, zip and deploy for tenant - a360/falcontest/caa3cc5277fc454695cb4c5e611aeee0

@diksha-sf diksha-sf merged commit ef67865 into forcedotcom:main Jun 15, 2026
4 checks passed
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.

2 participants