import importlib import my_module # 假設 my_module.py 已存在 # 重新載入模組(適用於修改後立即生效) importlib.reload(my_module)