Custom App: How/where to create DocTypes and Scripts?

I’m a bit confused by the Frappe documentation. I need to create a simple app that will work with ERPNext. I need to use a library in a Python script, so it can’t be done via a Server Script in ERPNext, unfortunately.

How do I create a custom method that can be called throughout ERPNext? In this case, the method will make a REST API call to a third-party API.

Hello @oguruma
You need to create a custom app. Then inside the custom app you should create a whitelist method. You should call from ERPNext UI to this method. This method will call your third party-api.

You can follow this doc for creating a custom app.
https://frappeframework.com/docs/user/en/tutorial/create-an-app

I get that, but where do I create the whitelisted method?

You can directly create any python file and start writing methods.
for example, if you want to write an API just create a file called custom_api.py and start writing like

@frappe.whitelist(allow_guest = True)
def custom_api():

Does the file just go in …/apps/custom_app/custom_api.py ?

Or does it go in a subdirectory somewhere?

You can create like this.