Restrict imports from specific directories to .py files only.