KushagraB424 opened a new issue, #71014: URL: https://github.com/apache/airflow/issues/71014
### Description In `airflow_shared/module_loading/__init__.py`, the `import_string(dotted_path)` utility currently contains a `TODO` noting that it only supports top-level classes: ```python # TODO: Add support for nested classes. Currently, it only works for top-level classes. ``` Airflow frequently relies on dotted path strings to dynamically load classes (e.g., operators, callbacks, secrets backends, etc.). Supporting nested classes allows developers to better encapsulate their code or utilize existing third-party libraries that rely on nested class structures. The current limitation requires users to expose all classes at the top-level module scope if they are to be dynamically imported by Airflow. Addressing this known `TODO` will provide greater flexibility and make the module loading utility more robust. ### Use case/motivation Airflow frequently relies on dotted path strings to dynamically load classes (e.g., operators, callbacks, secrets backends, etc.). Supporting nested classes allows developers to better encapsulate their code or utilize existing third-party libraries that rely on nested class structures. The current limitation requires users to expose all classes at the top-level module scope if they are to be dynamically imported by Airflow. Addressing this known `TODO` will provide greater flexibility and make the module loading utility more robust. ### Related issues None (resolves an existing `TODO` in `airflow_shared/module_loading/__init__.py`). ### Are you willing to submit a PR? - [x] Yes I am willing to submit a PR! ### Code of Conduct - [x] I agree to follow this project's [Code of Conduct](https://github.com/apache/airflow/blob/main/CODE_OF_CONDUCT.md) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
