How do I create shared Queries/JS scripts across pages?

I have multiple pages which need to call the same API. How can I create such an API which can be accessed across the pages?
If not, I need to update the API in every page if I am making a change.

Hey @stiwari thanks for reaching out. Currently it’s not possible to do this, we are going to work on the feature that enables this soon ([Epic] Reusable Actions · Issue #1911 · appsmithorg/appsmith · GitHub)

Can you please share your use-case and explain us what the API does to help us prioritise this? Also if you want to discuss on a call instead, you can block a slot here -Calendly - Dilip Pitchika