参考下面的 Ntj45的回答
https://intellij-support.jetbrains.com/hc/en-us/community/posts/205408470-Multiple-projects-inside-one-window-idea-uses-a-non-standard-layout-and-cannot-be-attached-to-this-project-
附原始答案:
I had the same problem for two times, at different folders. sometimes, re-cloning directory from git can solve this; but you can solve it manualy. That problem is caused by the lack of projectName.iml folder (your project name at place of projectName) in ".idea". you can just create a new project, and copy its new_projectName.iml file (your new project name at place of new_projectName) and change its name to projectName.iml (your project name at place of projectName). Then, it will work.
下面是 projectName.iml文件中的内容,pycharm版本是
Build # PY-171.4163.6, built on April 11,2017
<?xml version="1.0" encoding="UTF-8"?>
<module type="PYTHON_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>