# Creating a Custom Node on the basis of another Node as Dependency

**URL:** https://discourse.nodered.org/t/creating-a-custom-node-on-the-basis-of-another-node-as-dependency/70275
**Category:** Developing Nodes
**Created:** [8 November 2022 18:06 UTC](https://discourse.nodered.org/t/creating-a-custom-node-on-the-basis-of-another-node-as-dependency/70275 "2022-11-08T18:06:45Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![TomTomToGo](https://avatars.discourse-cdn.com/v4/letter/t/f14d63/32.png) [@TomTomToGo](https://discourse.nodered.org/u/TomTomToGo)
#### Post date: [8 November 2022 18:06 UTC](https://discourse.nodered.org/t/creating-a-custom-node-on-the-basis-of-another-node-as-dependency/70275/1 "2022-11-08T18:06:45Z")

</div>

Hi,

i am currently trying to create a custom node. In this custom node i need an instance from node-red-contrib-opcua. Especially from the server node there because i need the server object.

So i tried to "require" the whole server.js as a module inside my custom node. But this doesnt work because the module will try to register the server node which is already there.

Is there a better workaround for this? I need for example the initNewServer() function in this node. But it seemed to be encapsulated. Structure is:

module.exports = function (RED) {  
...  
OpcUaServerNode(n){  
...  
initNewServer(){

I am still a newbie with node.js and Node-RED so i don't know if there is a common solution for this. I know that i could create the server node from the "node-opcua" dependency myself, but it would be more logical for me to include the node-red-contrib-opcua as a Dependency because i work with more nodes from there inside my flows.

Thanks a lot

---

<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: [7 January 2023 18:07 UTC](https://discourse.nodered.org/t/creating-a-custom-node-on-the-basis-of-another-node-as-dependency/70275/2 "2023-01-07T18:07:44Z")

</div>

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