Unable to creating folder in file doctype using create_folder function from server side script

I want to create a folder and then upload images to the folder in file doctype
I got to know that create_folder function in file.py is creating the folders in file doctype when we created folder from frontend

Screenshot from 2024-12-17 14-24-12

I tried to use the same logic for creating folder, but folder is not getting created

I tried different values for specifying parent folder ie., file.folder such as
file.folder = “Patient Case Sheet” or file.folder = “Home/Patient Case Sheet”
there is already “Patient Case Sheet” folder present

but why folder is not getting created