# Vendor specific type

**URL:** <https://forum.opencyphal.org/t/vendor-specific-type/303>\
**Category:** PyCyphal\
**Created:** [December 18, 2018, 9:30pm UTC](https://forum.opencyphal.org/t/vendor-specific-type/303 "2018-12-18T21:30:28Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![deekay](https://forum.opencyphal.org/letter_avatar_proxy/v4/letter/d/8491ac/32.png) [@deekay](https://forum.opencyphal.org/u/deekay)\
**Post date:** [December 18, 2018, 9:30pm UTC](https://forum.opencyphal.org/t/vendor-specific-type/303/1 "2018-12-18T21:30:28Z")

</div>

Hi!

According to specification at [https://uavcan.org/Implementations/Pyuavcan/Tutorials/2.\_Basic\_usage/](https://uavcan.org/Implementations/Pyuavcan/Tutorials/2._Basic_usage/)  
pyuavcen loads vendor specific DSDLs when loaded (import uavcan).  
I have places my own definitions at this location:

```auto
~/uavcan_vendor_specific_types/mydefs/
# contains 20001.broadcast_type_test.uavcan

```

Then in my python script I try to load them like this:

```auto
import uavcan

node_info = uavcan.protocol.GetNodeInfo.Response()
node_info.name = 'TestNode'
node_info.software_version.major = 1
node = uavcan.make_node('vcan0', node_id=123, bitrate=125000, node_info=node_info)
node.mode = uavcan.protocol.NodeStatus().MODE_OPERATIONAL

def do_publish():
    msg = mydefs.broadcast_type_test(value=47)
    node.broadcast(msg, priority=uavcan.TRANSFER_PRIORITY_LOWEST)

handle = node.periodic(1, do_publish)

while True:
    node.spin(1) # Spin for 1 second or until an exception is thrown

node.close()

```

However, I det errors when running the script with

```auto
python3 myscript.py
...
  File "myscript.py", line 19, in do_publish
    msg = mydefs.broadcast_type_test(value=47)
NameError: name 'mydefs' is not defined

```

Sorry for my poor python knowledge, but what am I missing here?

Kind regards

---

<div class="post-metadata">

**Author:** ![antoine.albertelli](https://forum.opencyphal.org/user_avatar/forum.opencyphal.org/antoine.albertelli/32/14_2.png) [@antoine.albertelli](https://forum.opencyphal.org/u/antoine.albertelli)\
**Post date:** [December 19, 2018, 10:39am UTC](https://forum.opencyphal.org/t/vendor-specific-type/303/2 "2018-12-19T10:39:22Z")

</div>

Hi,

From the page you linked:

> Standard definitions can be reached directly from the module namespace, e.g. uavcan.protocol.NodeStatus. Vendor-specific definitions can be accessed via the pseudo-module uavcan.thirdparty. Both standard and vendor-specific types are also accessible via the global dictionaries uavcan.DATATYPES and uavcan.TYPENAMES.

That means you should access your custom data type like this:

```python
msg = uavcan.thirdparty.mydefs.broadcast_type_test(value=47)

```

Best,  
Antoine

---

<div class="post-metadata">

**Author:** ![deekay](https://forum.opencyphal.org/letter_avatar_proxy/v4/letter/d/8491ac/32.png) [@deekay](https://forum.opencyphal.org/u/deekay)\
**Post date:** [December 21, 2018, 10:28pm UTC](https://forum.opencyphal.org/t/vendor-specific-type/303/3 "2018-12-21T22:28:31Z")

</div>

Aha! Thanks, I misunderstood that…
