# What means the keyword "sec"?

**URL:** <https://forum.universal-robots.com/t/what-means-the-keyword-sec/5415>\
**Category:** URScript\
**Created:** [October 24, 2019, 2:26pm UTC](https://forum.universal-robots.com/t/what-means-the-keyword-sec/5415 "2019-10-24T14:26:52Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![anon57454834](https://avatars.discourse-cdn.com/v4/letter/a/f07891/32.png) [@anon57454834](https://forum.universal-robots.com/u/anon57454834)\
**Post date:** [October 24, 2019, 2:26pm UTC](https://forum.universal-robots.com/t/what-means-the-keyword-sec/5415/1 "2019-10-24T14:26:52Z")

</div>

What exactly does the keyword “sec”? It is mentioned in the scriptManual on page 4: "(either "def"or “sec"keywords)”  
But I found no other reference in this document. Can it even be used in URScript? I am getting syntax errors… (I tried to use it to define a thread, that is started automatically)

I found an advice, that it is used in conjunction with the “secondary interface”.

---

<div class="post-metadata">

**Author:** ![sko](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.universal-robots.com/sko/32/573_2.png) [@sko](https://forum.universal-robots.com/u/sko)\
**Post date:** [October 24, 2019, 2:45pm UTC](https://forum.universal-robots.com/t/what-means-the-keyword-sec/5415/2 "2019-10-24T14:45:37Z")

</div>

The keyword _sec_ is used in combination with the different client interfaces of the UR. If the UR should be controlled externally using script commands, this interfaces can be used. To let the robot execute more than one command and once, the different Script-lines can be combined by putting them in a function. This is then sent to the UR via a Socket communication. For example:

```
def test():
  movel()
  <...>
  set_digital_out()
end

```

The sent commands will be executed after the final _end_ is sent to the UR. If in the meantime another function is sent to the UR, the current executed function will be stopped and the new function will be started immediately.

The _sec_ key-phrase is used instead of _def_ to define a secondary function, which is then sent over port 30002 to the UR. This can then be used to execute commands, which do not take _physical_ time to execute. For example:

> ```
> sec secondaryProgram():
> set_digital_out(1, True)
> end
> 
> ```

This program/function will then be executed parallel to e.g. a robot movement.

Under following Link more information can be found: [Secondary program - 17257](https://www.universal-robots.com/how-tos-and-faqs/how-to/ur-how-tos/secondary-program-17257/)

---

<div class="post-metadata">

**Author:** ![m.birkholz](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.universal-robots.com/m.birkholz/32/7084_2.png) [@m.birkholz](https://forum.universal-robots.com/u/m.birkholz)\
**Post date:** [October 25, 2019, 11:01pm UTC](https://forum.universal-robots.com/t/what-means-the-keyword-sec/5415/3 "2019-10-25T23:01:05Z")

</div>

@sko wow How is this not mentioned in the urscript manual. That would have helped me a lot. Please add this information🙂

---

<div class="post-metadata">

**Author:** ![sko](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.universal-robots.com/sko/32/573_2.png) [@sko](https://forum.universal-robots.com/u/sko)\
**Post date:** [October 28, 2019, 12:55pm UTC](https://forum.universal-robots.com/t/what-means-the-keyword-sec/5415/4 "2019-10-28T12:55:36Z")

</div>

@m.birkholz, @anon57454834: Please take a look at the edit. The first explanation was not fully correct.
