# Access node-library from function-node

**URL:** <https://discourse.nodered.org/t/access-node-library-from-function-node/52930>\
**Category:** Developing Nodes\
**Created:** [29 October 2021 07:56 UTC](https://discourse.nodered.org/t/access-node-library-from-function-node/52930 "2021-10-29T07:56:18Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dunken](https://avatars.discourse-cdn.com/v4/letter/d/45deac/32.png) [@Dunken](https://discourse.nodered.org/u/Dunken)\
**Post date:** [29 October 2021 07:56 UTC](https://discourse.nodered.org/t/access-node-library-from-function-node/52930/1 "2021-10-29T07:56:18Z")

</div>

I already deployed my own node N which contains a library L.

Can I access L out of a Function-node? If yes, how can I do that?

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [29 October 2021 10:30 UTC](https://discourse.nodered.org/t/access-node-library-from-function-node/52930/2 "2021-10-29T10:30:19Z")

</div>

> [@Dunken](#):
>
> Can I access L out of a Function-node? If yes, how can I do that?

Have you tried?

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/e/7/e7d0726753305debe32c99742e80eefc0d7d92bf.png)

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/d/f/dfdc1c8d3c38218eaa43907ef910f2f66ecaa237.png)

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [29 October 2021 15:46 UTC](https://discourse.nodered.org/t/access-node-library-from-function-node/52930/3 "2021-10-29T15:46:19Z")

</div>

The functions in a custom node are not directly available to the function node because that wraps the function code in a Node.js "virtual machine".

So you will need to load the module containing the function using the method that Steve has suggested. It is easier though to have your common functions in their own package so that you only need to require that package and not try to reload the whole node package - not entirely sure what the impact of that will be - it could be that it still won't give you access to the function you want unless you have structured the export in the node module correctly.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [12 November 2021 15:46 UTC](https://discourse.nodered.org/t/access-node-library-from-function-node/52930/4 "2021-11-12T15:46:30Z")

</div>

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