Managing python functions and classes

Hey Everyone,
I need to write pretty lengthy code in some doctypes, so i was wondering if i could divide them as functions in separate files and then import them. I tried the usual import but doesn’t seem to work.
Is there a standard way to do this?
Note: The code is strictly back-end i.e in .py files only.
Thanks!

Akarsh

@Akarsh_Hegde do you can use “Hooks”

See the Crud Events section on this: https://frappe.github.io/frappe/user/guides/basics/hooks.html

Thanks! Works!