# \[Python\] Create Custom Library Folder?

**URL:** <https://discourse.mcneel.com/t/python-create-custom-library-folder/180175>\
**Category:** Scripting\
**Tags:** windows, python, rhino7\
**Created:** [April 16, 2024, 11:40am UTC](https://discourse.mcneel.com/t/python-create-custom-library-folder/180175 "2024-04-16T11:40:00Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![webdunce](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/webdunce/32/617446_2.png) [@webdunce](https://discourse.mcneel.com/u/webdunce)\
**Post date:** [April 16, 2024, 11:40am UTC](https://discourse.mcneel.com/t/python-create-custom-library-folder/180175/1 "2024-04-16T11:40:00Z")

</div>

Is it possible to use python to create a custom library folder. Like you could do manually by clicking on the New button in the libraries panel in the Rhino Options window? It’s okay if it isn’t, but it would be nice if it is. 🙂

Thanks in advance.

 ![2024-04-16_6-37-30](https://global.discourse-cdn.com/mcneel/uploads/default/original/4X/f/2/9/f29621fac69b14e7bbff55affff6d2a4e2e1060e.png)

---

<div class="post-metadata">

**Author:** ![dale](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/dale/32/685184_2.png) [@dale](https://discourse.mcneel.com/u/dale)\
**Post date:** [April 16, 2024, 2:52pm UTC](https://discourse.mcneel.com/t/python-create-custom-library-folder/180175/2 "2024-04-16T14:52:52Z")

</div>

Hi @webdunce,

Use this:

 ![image](https://global.discourse-cdn.com/mcneel/uploads/default/original/4X/7/9/6/7960443241b03700f9e61d63a99564bb34d730ba.png)

– Dale

---

<div class="post-metadata">

**Author:** ![webdunce](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/webdunce/32/617446_2.png) [@webdunce](https://discourse.mcneel.com/u/webdunce)\
**Post date:** [April 16, 2024, 5:10pm UTC](https://discourse.mcneel.com/t/python-create-custom-library-folder/180175/3 "2024-04-16T17:10:40Z")

</div>

Thanks Dale. I will give it a try and see how it goes.

---

<div class="post-metadata">

**Author:** ![webdunce](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/webdunce/32/617446_2.png) [@webdunce](https://discourse.mcneel.com/u/webdunce)\
**Post date:** [April 17, 2024, 7:29am UTC](https://discourse.mcneel.com/t/python-create-custom-library-folder/180175/4 "2024-04-17T07:29:54Z")

</div>

Hi Dale,

The reason I was hoping I could programmatically add paths to the Libraries custom folders list is because those paths show up in the drop down menu of the Library side panel, but paths I add to the Search Paths list don’t seem to show up there. Have I missed something?

And I will understand if what I want to do is not possible, I just wanted to be sure it wasn’t possible before I give up on it.

![2024-04-17_2-23-26](https://global.discourse-cdn.com/mcneel/uploads/default/original/4X/a/7/6/a76514117b2e6908a297f4c54c35d714203a342b.png)

---

<div class="post-metadata">

**Author:** ![scottd](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/scottd/32/494002_2.png) [@scottd](https://discourse.mcneel.com/u/scottd)\
**Post date:** [April 17, 2024, 8:00am UTC](https://discourse.mcneel.com/t/python-create-custom-library-folder/180175/5 "2024-04-17T08:00:31Z")

</div>

Rhino 8 the # env can be added, which will add the folder to the sys.path: [Rhino - ScriptEditor Command](https://developer.rhino3d.com/guides/scripting/scripting-command/#python-libraries-modules)

---

<div class="post-metadata">

**Author:** ![webdunce](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/webdunce/32/617446_2.png) [@webdunce](https://discourse.mcneel.com/u/webdunce)\
**Post date:** [April 17, 2024, 9:46am UTC](https://discourse.mcneel.com/t/python-create-custom-library-folder/180175/7 "2024-04-17T09:46:06Z")

</div>

Hi Scott,

I make a kit that includes a folder that contains a bunch of models (.3dm files). I want to make that folder available to the end user via the _Libraries panel_ so they can drag and drop my models into their document from the side panel. Right now they have to set it up manually. I would prefer to set it up for them via a script.

Manually, this is done by adding the folder to a list of custom library folders in the Libraries panel of the Rhino Options window. I’m asking can I use python to add a folder to that list of custom library folders. I’m thinking it’s not possible.

---

<div class="post-metadata">

**Author:** ![dale](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/dale/32/685184_2.png) [@dale](https://discourse.mcneel.com/u/dale)\
**Post date:** [April 17, 2024, 4:29pm UTC](https://discourse.mcneel.com/t/python-create-custom-library-folder/180175/8 "2024-04-17T16:29:26Z")

</div>

Hi @webdunce,

There is no API access to this. I’ve logged a few wishes.

[https://mcneel.myjetbrains.com/youtrack/issue/RH-81594](https://mcneel.myjetbrains.com/youtrack/issue/RH-81594)

[https://mcneel.myjetbrains.com/youtrack/issue/RH-81595](https://mcneel.myjetbrains.com/youtrack/issue/RH-81595)

Thanks,

– Dale

---

<div class="post-metadata">

**Author:** ![webdunce](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/webdunce/32/617446_2.png) [@webdunce](https://discourse.mcneel.com/u/webdunce)\
**Post date:** [April 17, 2024, 4:43pm UTC](https://discourse.mcneel.com/t/python-create-custom-library-folder/180175/9 "2024-04-17T16:43:42Z")

</div>

Okay, thanks, Dale.

---

<div class="post-metadata">

**Author:** ![maxsoder](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/maxsoder/32/771053_2.png) [@maxsoder](https://discourse.mcneel.com/u/maxsoder)\
**Post date:** [June 5, 2024, 9:01am UTC](https://discourse.mcneel.com/t/python-create-custom-library-folder/180175/12 "2024-06-05T09:01:53Z")

</div>

```auto
import Rhino
import scriptcontext as sc

def custom_folder():

    # Adds a folder below the Custom radiobutton
    Rhino.Render.SupportOptions.Libraries_SetCustomPath("/Users/maxsoderstrom/Desktop");

    # Turns on the Show custom folders checkbox
    Rhino.Render.SupportOptions.Libraries_SetShowCustom(True);

    # Sets the inital folder to Custom custom_folder.
    Rhino.Render.SupportOptions.Libraries_SetInitialLocation(Rhino.Render.SupportOptions.RdkInitialLocation.CustomFolder);

    # Adds two folders to the folder list. The paths are separated with ;
    Rhino.Render.SupportOptions.Libraries_SetCustomPathList("/Users/maxsoderstrom/Documents;/Users/maxsoderstrom/Downloads")

    # False will turn the Custom radio open. True will turn the Use default library location on
    Rhino.Render.SupportOptions.Libraries_SetUseDefaultLocation(False);

custom_folder()

```

---

<div class="post-metadata">

**Author:** ![maxsoder](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/maxsoder/32/771053_2.png) [@maxsoder](https://discourse.mcneel.com/u/maxsoder)\
**Post date:** [June 5, 2024, 9:02am UTC](https://discourse.mcneel.com/t/python-create-custom-library-folder/180175/13 "2024-06-05T09:02:47Z")

</div>

@webdunce Hope the above script my help

---

<div class="post-metadata">

**Author:** ![webdunce](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/webdunce/32/617446_2.png) [@webdunce](https://discourse.mcneel.com/u/webdunce)\
**Post date:** [June 7, 2024, 11:25pm UTC](https://discourse.mcneel.com/t/python-create-custom-library-folder/180175/14 "2024-06-07T23:25:01Z")

</div>

Hi Max,

Thanks for coming up with those functions. I tried it, but I get this error. I get this error if I run it from the editor or if I run it from Tools \> Script \> Run. I only tried the Libraries\_CustomPath() method, but all these new functions do appear in my Intellisense-like popup now.

 ![2024-06-07_18-12-04](https://global.discourse-cdn.com/mcneel/uploads/default/original/4X/3/f/3/3f3565c4e51df86344aad8b23522a633310cc99a.png)

---

<div class="post-metadata">

**Author:** ![maxsoder](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/maxsoder/32/771053_2.png) [@maxsoder](https://discourse.mcneel.com/u/maxsoder)\
**Post date:** [June 8, 2024, 5:28am UTC](https://discourse.mcneel.com/t/python-create-custom-library-folder/180175/16 "2024-06-08T05:28:12Z")

</div>

Use Libraries\_SetCustomPathList to set the paths. The CustomPath takes no arguments and returns the paths.
