# Wrap nodes in a function

**URL:** <https://discourse.nodered.org/t/wrap-nodes-in-a-function/10126>\
**Category:** General\
**Created:** [14 April 2019 14:11 UTC](https://discourse.nodered.org/t/wrap-nodes-in-a-function/10126 "2019-04-14T14:11:15Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![manooten](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/manooten/32/7560_2.png) [@manooten](https://discourse.nodered.org/u/manooten)\
**Post date:** [14 April 2019 14:11 UTC](https://discourse.nodered.org/t/wrap-nodes-in-a-function/10126/1 "2019-04-14T14:11:16Z")

</div>

Is there a way of wrapping a set of nodes into a function? Imagine you have 5 nodes that go to a website and scrap some content, and you want to use the result of that on other flows. Create a node that does all that, and then call it. Just like a function in any programming language.

Thanks!

---

<div class="post-metadata">

**Author:** ![manooten](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/manooten/32/7560_2.png) [@manooten](https://discourse.nodered.org/u/manooten)\
**Post date:** [14 April 2019 14:18 UTC](https://discourse.nodered.org/t/wrap-nodes-in-a-function/10126/2 "2019-04-14T14:18:52Z")

</div>

I'll answer my own question 🙃. Found the answer on [https://nodered.org/docs/user-guide/editor/workspace/subflows](https://nodered.org/docs/user-guide/editor/workspace/subflows)

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [14 April 2019 14:20 UTC](https://discourse.nodered.org/t/wrap-nodes-in-a-function/10126/3 "2019-04-14T14:20:40Z")

</div>

Take a look at subflows - you can select a number of nodes then go to the hamburger menu and select the 'Subflow' option

 ![subflow](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/6/664aff218efd427a051c33ca5fe3514186893205.jpeg)
