# Using Try in Design Script

**URL:** <https://forum.dynamobim.com/t/using-try-in-design-script/40380>\
**Category:** Uncategorized\
**Created:** [September 5, 2019, 11:12pm UTC](https://forum.dynamobim.com/t/using-try-in-design-script/40380 "2019-09-05T23:12:57Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Steven](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/steven/32/112504_2.png) [@Steven](https://forum.dynamobim.com/u/Steven)\
**Post date:** [September 5, 2019, 11:12pm UTC](https://forum.dynamobim.com/t/using-try-in-design-script/40380/1 "2019-09-05T23:12:57Z")

</div>

Hi all,

Has the Try and catch function been enabled yet?  
[https://github.com/DynamoDS/Dynamo/issues/6218](https://github.com/DynamoDS/Dynamo/issues/6218)

I am trying to check if a family has been loaded into the current document. If it is loadded I do not want to load it in from the default location in case changes have been made. I tried using an if statement with design script but it still fails. I can probably figure out how to do it with python but I can not find the API call for _Family.ByName_

Any ideas?

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/b/1/b155409211e3c2fc538268ff209f6da3e6314cc5.png)

Thank you,  
Steven

---

<div class="post-metadata">

**Author:** ![jacob.small](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/jacob.small/32/161030_2.png) [@jacob.small](https://forum.dynamobim.com/u/jacob.small)\
**Post date:** [September 5, 2019, 11:22pm UTC](https://forum.dynamobim.com/t/using-try-in-design-script/40380/2 "2019-09-05T23:22:43Z")

</div>

I do not believe it has been, but others may know better.

To confirm what you’re after -

- Get a family by name.
- If it works great, move on.
- If it fails load a family from an external source.

That sound about right?

---

<div class="post-metadata">

**Author:** ![jacob.small](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/jacob.small/32/161030_2.png) [@jacob.small](https://forum.dynamobim.com/u/jacob.small)\
**Post date:** [September 5, 2019, 11:28pm UTC](https://forum.dynamobim.com/t/using-try-in-design-script/40380/3 "2019-09-05T23:28:00Z")

</div>

I think it’s possible to use an if statement for this single depth of catching, but I need to know what package your File.LoadFamily is from to know for certain.

Simple If statement has me pretty hopeful (obviously not in imperative form and a very simple use case):

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/7/7/77b01873a5e7a8244ff3900a4656a37ff5232bd6.png)

---

<div class="post-metadata">

**Author:** ![Steven](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/steven/32/112504_2.png) [@Steven](https://forum.dynamobim.com/u/Steven)\
**Post date:** [September 6, 2019, 12:06am UTC](https://forum.dynamobim.com/t/using-try-in-design-script/40380/4 "2019-09-06T00:06:03Z")

</div>

Hi @jacob.small,

Thanks for the quick turn around. _File.LoadFamily_ is from the Orchid Package.

Copying what you have done the _Code Block_ errors out but it does load the family. Do you know if there is a way to stop the error?

I am in Dynamo 2.0.3.8104 and Revit 2019

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/0/4/04150c761f19aee4381b9519ae5483409cb1dcd8.png)  
 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/7/7/77ef9a92216f4044fbc6c966de8f8a14a3548dbf.png)

---

<div class="post-metadata">

**Author:** ![stillgotme](https://avatars.discourse-cdn.com/v4/letter/s/e480ec/32.png) [@stillgotme](https://forum.dynamobim.com/u/stillgotme)\
**Post date:** [September 6, 2019, 1:01am UTC](https://forum.dynamobim.com/t/using-try-in-design-script/40380/5 "2019-09-06T01:01:37Z")

</div>

i think you will need to activate its symbol by using a python script.  
[https://www.revitapidocs.com/2016/b4e09402-f6cd-3f48-d01e-ecb87375bac5.htm](https://www.revitapidocs.com/2016/b4e09402-f6cd-3f48-d01e-ecb87375bac5.htm)

---

<div class="post-metadata">

**Author:** ![jacob.small](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/jacob.small/32/161030_2.png) [@jacob.small](https://forum.dynamobim.com/u/jacob.small)\
**Post date:** [September 6, 2019, 3:53am UTC](https://forum.dynamobim.com/t/using-try-in-design-script/40380/6 "2019-09-06T03:53:28Z")

</div>

Sadly Orchid has become a bit difficult for me to work with… I’ll try to get it reinstalled on my current package library tomorrow.

Off the top of my head you could try to suppress this warning by wrapping the function in a list and using a List.GetItemAtIndex function on the list. If it works you can file that under ‘bug as a feature’. It will likely get fixed at some point but you’ll have a few years without the warning.

---

<div class="post-metadata">

**Author:** ![Dimitar\_Venkov](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/dimitar_venkov/32/2068_2.png) [@Dimitar\_Venkov](https://forum.dynamobim.com/u/Dimitar_Venkov)\
**Post date:** [September 6, 2019, 5:35am UTC](https://forum.dynamobim.com/t/using-try-in-design-script/40380/7 "2019-09-06T05:35:00Z")

</div>

Associative IF code evaluates and runs both conditions but with an imperarive function, that’s not the case.

---

<div class="post-metadata">

**Author:** ![Steven](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/steven/32/112504_2.png) [@Steven](https://forum.dynamobim.com/u/Steven)\
**Post date:** [September 6, 2019, 3:58pm UTC](https://forum.dynamobim.com/t/using-try-in-design-script/40380/8 "2019-09-06T15:58:23Z")

</div>

Thank you everyone for your help.

I found a good easy workaround after messing around with your suggestion Jacob.

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/8/9/89cb4d204289058d94e35b6f1dcc8c1ed570d769.png)
