# Import function from module

**URL:** <https://discourse.nodered.org/t/import-function-from-module/87913>\
**Category:** General\
**Created:** [13 May 2024 12:01 UTC](https://discourse.nodered.org/t/import-function-from-module/87913 "2024-05-13T12:01:34Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![mu3](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/mu3/32/4332_2.png) [@mu3](https://discourse.nodered.org/u/mu3)\
**Post date:** [13 May 2024 12:01 UTC](https://discourse.nodered.org/t/import-function-from-module/87913/1 "2024-05-13T12:01:34Z")

</div>

How can I import specific function **(not the default one)** from a ES6 module using editor UI?  
`import { OAuth2Client } from 'google-auth-library';`

 ![Screenshot 2024-05-13 at 14.58.48](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/a/4/a48a6d3700b82752514f412422d9274cacedb52b.png)

It is probably possible to achieve it with `functionExternalModules: true`, `requre()` and `global.get()`, but maybe there's a more convinient way inside the editor.

Also, I'm not sure how `functionExternalModules` works with the new versions of Node-RED.

---

<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:** [13 May 2024 12:20 UTC](https://discourse.nodered.org/t/import-function-from-module/87913/2 "2024-05-13T12:20:26Z")

</div>

Try sending `googleAuthLibrary` to a debug node

Eg. `node.warn({googleAuthLibrary})`

You'll _probably_ see it contains the `OAuth2Client` function/class meaning you can access it via `googleAuthLibrary.OAuth2Client` or `const {OAuth2Client} = googleAuthLibrary`

* * *

Ps, please don't tag people arbitrarily.

---

<div class="post-metadata">

**Author:** ![mu3](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/mu3/32/4332_2.png) [@mu3](https://discourse.nodered.org/u/mu3)\
**Post date:** [13 May 2024 12:32 UTC](https://discourse.nodered.org/t/import-function-from-module/87913/3 "2024-05-13T12:32:43Z")

</div>

Legend! 🤩

---

<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:** [27 May 2024 12:33 UTC](https://discourse.nodered.org/t/import-function-from-module/87913/4 "2024-05-27T12:33:11Z")

</div>

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