'Adds to `[app]/modules.txt`'

def add_to_modules_txt(self):

    modules = None
    if (not frappe.local.module_app.get(frappe.scrub(self.name))):
        with open(frappe.get_app_path(self.app_name, u'modules.txt'), u'r') as f:
            content = f.read()
            if (not (self.name in content.splitlines())):
                modules = filter(None, content.splitlines())
                modules.append(self.name)
        if modules:
            with open(frappe.get_app_path(self.app_name, u'modules.txt'), u'w') as f:
                f.write(u'\n'.join(modules))
            frappe.clear_cache()
            frappe.setup_module_map()
