How to rename module in custom app

i could not rename exist module successfully


Please check it.

Otherwise, you can also search it in the forum:
https://discuss.frappe.io/search?q=rename%20module

How to Rename a Module in Frappe (Safely)

Renaming a module in Frappe requires updating both the UI and the source code to ensure consistency. Follow the steps below:

Step 1: Rename the Module from the Desk (UI)

  1. Go to the Module Def (Module Definition) from the Desk.
  2. Rename the module by clicking on the Rename option.
  3. When prompted, choose “Merge with existing” if a module with the new name already exists.
  4. Confirm the change.

Step 2: Rename the Module Folder in the Source Code

  1. Navigate to your app’s module folder, usually located at:apps/[your_app]/[your_app]/[module_name]
  2. Rename the folder to match the new module name exactly (use snake_case).attachments → parent_attachments

Step 3: Update Doctype Definitions

Each Doctype that was under the old module name must be updated to reflect the new module name:

  1. Go to:apps/[your_app]/[your_app]/[new_module_name]/doctype/[doctype_name]/[doctype_name].json
  2. Open the .json file for each Doctype and look for the "module" field.
  3. Update the value to the new module name (as it appears in the system — Title Case)."module": "Attachments" → "module": "Parent Attachments"

Step 4: Update modules.txt

  1. Open the modules.txt file located at:apps/[your_app]/[your_app]/modules.txt
  2. Ensure the new module name is listed in the file (Title Case).
  3. Remove the old module name to avoid errors like “Module not found”.

Notes

  • After completing all steps, run:
    bench build
    bench clear-cache
    bench migrate
  • Restart your bench if necessary:bench restart

Common Mistakes

  • Mismatch between folder name (snake_case) and "module" field (Title Case).
  • Forgetting to update the modules.txt file.
  • Not updating all DocTypes that belong to the renamed module.