'attach a file from the `FileData` table'

def attach_file(self, n):

    from frappe.utils.file_manager import get_file
    res = get_file(n)
    if (not res):
        return
    self.add_attachment(res[0], res[1])
