Error adding new Module Def

Hey guys,
So I am trying to add a new Doctype and a new Module Def.

The error appearing is this:

ImportError: No module named hotel_transportation

I am running on:

ERPNext: v12.1.5 (version-12)

Frappe Framework: v12.0.10 (version-12)

Any idea what’s this about ?

LATE EDIT for Traceback error

[ERROR] 2019-10-09 09:14:36,489 | /home/frappe/frappe-bench/apps/frappe/frappe/
Form Dict: {
 "action": "Save",
 "cmd": "",
 "doc": "{\"docstatus\":0,\"doctype\":\"Module Def\",\"name\":\"New Module Def 1\",\"__islocal\":1,\"__unsaved\":1,\"owner\":\"Administrator\",\"module_name\":\"Hotel trans$
Request Error
Traceback (most recent call last):
  File "/home/frappe/frappe-bench/apps/frappe/frappe/", line 60, in application
    response = frappe.api.handle()
  File "/home/frappe/frappe-bench/apps/frappe/frappe/", line 55, in handle
    return frappe.handler.handle()
  File "/home/frappe/frappe-bench/apps/frappe/frappe/", line 21, in handle
    data = execute_cmd(cmd)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/", line 56, in execute_cmd
    return, **frappe.form_dict)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/", line 1036, in call
    return fn(*args, **newargs)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/desk/form/", line 22, in savedocs
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/", line 271, in save
    return self._save(*args, **kwargs)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/", line 294, in _save
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/", line 258, in insert
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/", line 917, in run_post_save_methods
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/", line 786, in run_method
    out = Document.hook(fn)(self, *args, **kwargs)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/", line 1056, in composer
    return composed(self, method, *args, **kwargs)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/", line 1039, in runner
    add_to_return_value(self, fn(self, *args, **kwargs))
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/", line 780, in <lambda>
    fn = lambda self, *args, **kwargs: getattr(self, method)(*args, **kwargs)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/core/doctype/module_def/", line 15, in on_update
  File "/home/frappe/frappe-bench/apps/frappe/frappe/core/doctype/module_def/", line 20, in create_modules_folder
    module_path = frappe.get_app_path(self.app_name,
  File "/home/frappe/frappe-bench/apps/frappe/frappe/", line 831, in get_app_path
    return get_pymodule_path(app_name, *joins)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/", line 846, in get_pymodule_path
    return os.path.join(os.path.dirname(get_module(scrub(modulename)).__file__), *joins)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/", line 808, in get_module
    return importlib.import_module(modulename)
  File "/usr/lib/python2.7/importlib/", line 37, in import_module
ImportError: No module named hotel_transportation

In your database, table Module Def check if there is an entry by the same name. If yes, delete that row.

How is it possible to have such a row if this is a brand new Module Def to be added ? haha :slight_smile:

You were adding Hotel Transportation as a new module def ?

Yes indeed, a brand new Doctype with a brand new Module Def…

What did you set in the field app ?

Same name as the module def …

any chance you created the app but forgot to install it on the site ?

No chance because I don’t know how to do that by myself haha but I will double check maybe somehow I did that accidentally … it’s a good point :slight_smile: