{
  "id": "python/flask-circular-import-blueprint",
  "signature": "ImportError: cannot import name 'bp' from partially initialized module 'app.routes' (most likely due to a circular import)",
  "signature_zh": "ImportError: 无法从部分初始化的模块'app.routes'导入名称'bp'（最可能的原因是循环导入）",
  "regex": "ImportError:\\ cannot\\ import\\ name\\ 'bp'\\ from\\ partially\\ initialized\\ module\\ 'app\\.routes'\\ \\(most\\ likely\\ due\\ to\\ a\\ circular\\ import\\)",
  "domain": "python",
  "category": "module_error",
  "subcategory": null,
  "root_cause": "Two modules import each other, often app -> routes -> app for `app` object or blueprint registration.",
  "root_cause_type": "generic",
  "root_cause_zh": "两个模块相互导入，通常是app -> routes -> app以获取app对象或注册蓝图。",
  "versions": [
    {
      "version": "2.x",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "3.x",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "Still executed at import time; cycle remains.",
      "fail_rate": 0.65,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Cycle is structural, not naming.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.93,
      "how": "def create_app():\\n    app = Flask(__name__)\\n    from .routes import bp\\n    app.register_blueprint(bp)\\n    return app",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.88,
      "how": "def register():\\n    from .routes import bp\\n    app.register_blueprint(bp)",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": null,
  "official_doc_section": null,
  "error_code": null,
  "verification_tier": "ai_generated",
  "confidence": 0.86,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2024-07-24",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}