discover_imports
relationalai.agent.cortex.discover_imports
discover_imports(file_path: Optional[str] = None) -> List[Tuple[str, str]]Discover all user (non-dependency) imports from the given file and its dependencies.
Recursively discovers imports from imported modules (transitive dependencies). Only includes top-level custom modules (not standard library or dependencies). Always returns an empty list on errors, with warnings logged.
Output is intended to be passed directly to the imports parameter of
the snowflake.snowpark.Session.sproc.register().
Parameters
Section titled “Parameters”
(file_pathstr, default:None) - Path to a file to analyze. IfNone, uses the calling file.
Returns
Section titled “Returns”list of tuple of (str, str)- List of(module_path, module_name)tuples for discovered user modules.
Examples
Section titled “Examples”>>> imports = discover_imports()>>> imports[('src/myproject/', 'myproject')]