Public API Reference
import_files(path)
Recursively imports all Python files found in the specified directory and its subdirectories,
excluding __init__.py. This function is intended to facilitate the dynamic loading of modules,
particularly useful in scenarios like automatic model discovery in web applications.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str
|
The directory path from which Python files should be imported. |
required |
Note
- This function modifies the global namespace by dynamically importing modules.
- Import paths are adjusted to be relative, considering the package structure.
Source code in graftql/__init__.py
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | |