Can i import libraries in server side scripting?

i want to import some libraries in server side scripting like import date or something else and it didn’t work for me is the any help ?

I think you will need to whitelist your scripts (not a “normal” API script). See:

i didn’t found answer for my question there so i asked here but thanks to your respond

What you should have is something like the following:
you should create a file (e.g. on the server that should start with the following:

import frappe
import datetime
import whaterver_other_library


def retrive_date():


and if you need a client script to call it:{
	method: "", //path should have dot (.)
\\instead of forwardslashes and its root should be:
//  /home/frappe_user/frappe-bench/apps/name_of_default_app (i think)
// for example see below
	freeze: true,
	callback: (r) => {

example of a path:
with retrive_date function defind would become:

Thanks , it worked now

Those external files will disappear (unless you have manual backups) if you have to reinstall erpnext or server crashes in future.

Better option is to create Apps, and backed up in version control system. App installation is easier and risk free compared to manually creating those files again.