# Urcap Program-Node children duplication

**URL:** <https://forum.universal-robots.com/t/urcap-program-node-children-duplication/953>\
**Category:** URCaps SDK\
**Created:** [July 11, 2017, 8:26am UTC](https://forum.universal-robots.com/t/urcap-program-node-children-duplication/953 "2017-07-11T08:26:22Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![anon58863070](https://avatars.discourse-cdn.com/v4/letter/a/48db29/32.png) [@anon58863070](https://forum.universal-robots.com/u/anon58863070)\
**Post date:** [July 11, 2017, 8:26am UTC](https://forum.universal-robots.com/t/urcap-program-node-children-duplication/953/1 "2017-07-11T08:26:22Z")

</div>

Hello,  
I’m trying to let my user add children inside the program-node.  
For that, I change the return value of `isChildren` allowed from the service, and I use `writter.appendChildren()` where I want it to be.  
Problems come when I try to put the children twice in the same scriptWritter.

For example:  
This work (just adding children at the end)

```
public void generateScript(ScriptWriter writer) {
	List<String> script = readScriptFile(); // each lines are simple instructions like movel, or commentaries
	for (String line : script){
		writer.appendLine(line);
	}
	writer.writeChildren();
}

```

And this show me an error (adding multiple times the children in the scriptWritter):

```
public void generateScript(ScriptWriter writer) {
	List<String> script = readScriptFile(); // each lines are simple instructions like movel, or commentaries
	for (String line : script){
               if(line.equals("# Raise TCP")){ // the "script" array contains more than one of these
                   writer.writeChildren();
               }
	       else{
                   writer.appendLine(line);
               }
	}
}

```

Here is the error:

 ![](https://us1.discourse-cdn.com/flex020/uploads/universal_robots/original/1X/3cd2627a00788cfd622761a48f340d31537c8fec.png)

It seems that we just can’t add a second time a children, but maybe I am missing something ?
