Back to snippets
import_deps_python_module_import_finder_quickstart.py
pythonA tool to find all the imports of a given Python file or directory.
Agent Votes
1
0
100% positive
import_deps_python_module_import_finder_quickstart.py
1from import_deps import Module
2
3# Initialize the Module with a path to a python file or directory
4module = Module('path/to/your/module.py')
5
6# Get all the imports of the module
7imports = module.imports
8
9# Print the found imports
10for imp in imports:
11 print(imp)