Error while running a server side custom script

Hi Everyone,
I am writing a script for creating a folder with the name of Document as well as I am trying to move all the files attached to that particular document should move into folder created for the document.
However my create folder code is working but when I am trying to run the movee_file function I am getting the below error:

AttributeError: ‘module’ object has no attribute ‘movee_file’

What does it mean?

Below is my python code:

# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt


from __future__ import unicode_literals
import frappe
import logging
import string
import datetime
import re
import json
import os
import requests
import requests.exceptions
import StringIO
import mimetypes, imghdr
import urllib
import frappe, frappe.utils

from frappe.utils import getdate, flt,validate_email_add,cint
from frappe.model.naming import make_autoname
from frappe.model.document import Document
from frappe.model.mapper import get_mapped_doc
from frappe.utils.file_manager import delete_file_data_content, get_content_hash, get_random_filename
from frappe.utils import get_files_path
from frappe import _

from frappe.utils.nestedset import NestedSet
from frappe.utils import strip

_logger = logging.getLogger(frappe.__name__)


@frappe.whitelist()
def createe_folder(file_name,fldr):
	""" create new folder under current parent folder """
	file = frappe.new_doc("File")
	file.file_name = file_name
	file.is_folder = 1
	file.folder = fldr
	file.insert()

@frappe.whitelist()
def movee_file(doc_name,new_parent, old_parent):
	file_list[]=frappe.db.sql("""SELECT file_name from tabFile where attached_to_name=%s""",doc_name)

	for file_obj in file_list:
		setup_folder_path(file_list[file_obj], new_parent)

	# recalculate sizes
	frappe.get_doc("File", old_parent).save()
	frappe.get_doc("File", new_parent).save()

JS Code

frappe.provide("frappe.ui");
frappe.ui.form.on("BOM","create_folder", function(frm, doctype, name) {
		        
				var data =  {
					"file_name": frm.doc.name,
					"fldr": "Home"
				};
				frappe.call({
                           method: "library_management.library_management.folder_script.createe_folder",
					//method: "frappe.core.doctype.file.file.create_new_folder",
					args: data,
                                        callback: function(r) { }
				})
			
		       
				var data1 =  {
					"doc_name":frm.doc.name,
                                        "new_parent": frm.doc.name,
					"old_parent": "Attachments"
				};
				frappe.call({
                           method: "library_management.library_management.folder_script.movee_file",
					//method: "frappe.core.doctype.file.file.create_new_folder",
					args: data1,
                                        callback: function(r) { }
				})
			
		});

I appreciat if anyone can help me.

Regards
Ruchin Sharma

Can you make sure that the function is inside of library_management/library_management/folder_script.py?

@vjFaLk
Yes, it is there?

Hi,
I have resolved the problem but really don’t know what was that, I just created a new file a paste the code there and use the reference of new file.
Now I am getting another error:

@frappe.whitelist()
def movee_file(doc_name,new_parent,old_parent):
	file_list=frappe.db.sql("""SELECT file_name from tabFile where attached_to_name=%s""",doc_name)

	for file_obj in file_list:
		setup_folder_paths(file_obj.file_name, new_parent)

	# recalculate sizes
	frappe.get_doc("File", old_parent).save()
	frappe.get_doc("File", new_parent).save()

tuple object as no attribute file_name
Can anybody tell me what will be the solution of the same, however I tried to change the query with

file_list=frappe.db.sql("""SELECT * from tabFile where attached_to_name=%s""",doc_name)

but still it didn’t work same error.

Regards
Ruchin Sharma