PyFile (@NotNull Module module) { for (VirtualFile root : PyUtil.getSourceRoots(module)) { final VirtualFile child = root.findChild("setup.py"); if (child != null) { final PsiFile file = ReadAction.compute(() -> PsiManager.getInstance(module.getProject()).findFile(child)); if (file instanceof PyFile) { return (PyFile)file; } } } return null; }