# Inherit functions from collection to another collection

**URL:** <https://community.postman.com/t/inherit-functions-from-collection-to-another-collection/51851>\
**Category:** Help Hub\
**Tags:** tests, automation, variables, collections, pre-request-script\
**Created:** [September 15, 2023, 1:57pm UTC](https://community.postman.com/t/inherit-functions-from-collection-to-another-collection/51851 "2023-09-15T13:57:10Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![acihad](https://avatars.discourse-cdn.com/v4/letter/a/a183cd/32.png) [@acihad](https://community.postman.com/u/acihad)\
**Post date:** [September 15, 2023, 1:57pm UTC](https://community.postman.com/t/inherit-functions-from-collection-to-another-collection/51851/1 "2023-09-15T13:57:10Z")

</div>

“I have functions defined under pre-request in a collection, and these functions are contained within an object. In the new collection that I create, I don’t want to constantly copy/paste the same functions. Can I designate one collection as a base and call these functions within the object in the new collections?”

---

<div class="post-metadata">

**Author:** ![danny-dainton](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/danny-dainton/32/29401_2.png) [@danny-dainton](https://community.postman.com/u/danny-dainton)\
**Post date:** [September 15, 2023, 3:23pm UTC](https://community.postman.com/t/inherit-functions-from-collection-to-another-collection/51851/2 "2023-09-15T15:23:35Z")

</div>

Hey @acihad 👋

I’ve added a Collection to the [Postman Answers](https://www.postman.com/postman/workspace/postman-answers) Public Workspace that demonstrates a very basic way to store the functions at the Global level.

These can then be used in any of the Workspaces Collections, after calling the `utils` variable using:

```auto
eval(pm.globals.get("utils"));

```

In the example, I’ve used this at the request level but you _should_ be able to place this statement at the Collection and not have to repeat it with each request.

[https://www.postman.com/postman/workspace/postman-answers/collection/1794236-d4aabd0d-f2c4-4905-80a5-61b35ebc54d4?action=share&source=copy-link&creator=1794236](https://www.postman.com/postman/workspace/postman-answers/collection/1794236-d4aabd0d-f2c4-4905-80a5-61b35ebc54d4?action=share&source=copy-link&creator=1794236)

---

<div class="post-metadata">

**Author:** ![system](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/system/32/29796_2.png) [@system](https://community.postman.com/u/system)\
**Post date:** [October 30, 2023, 3:24pm UTC](https://community.postman.com/t/inherit-functions-from-collection-to-another-collection/51851/3 "2023-10-30T15:24:17Z")

</div>

Closed on October 30, 2023, 3:24pm UTC

This topic was automatically closed 45 days after the last reply. New replies are no longer allowed.
