Automation · Python Automation
Modules
Cheat sheet · https://pcornel.dk/topic.php?topic=5258
Answer
Python modules are .py files or packages you import, from the standard library like os and json or third-party packages from PyPI, organizing automation into reusable parts.
Remember
- Import standard library and PyPI packages.
- Organize code into packages.
- Avoid circular imports.
First checks
python3 -c 'import mymodule; print(mymodule.__file__)'— import pathpython3 -m pip show <pkg>— package info- Package structure (pyproject.toml) — layout
Verify in this order
package → modules → imports
Where it usually breaks
Input/desired state → request accepted → job/task terminal status → target object read-back → effective runtime state → original workload → regression/rollback readiness.
Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=5258