# Update grasshopper user object / cluster with python or manually GH\_UpgradeUtil

**URL:** <https://discourse.mcneel.com/t/update-grasshopper-user-object-cluster-with-python-or-manually-gh-upgradeutil/109225>\
**Category:** Grasshopper Developer\
**Created:** [September 24, 2020, 11:34am UTC](https://discourse.mcneel.com/t/update-grasshopper-user-object-cluster-with-python-or-manually-gh-upgradeutil/109225 "2020-09-24T11:34:16Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![martinborst1](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/martinborst1/32/607738_2.png) [@martinborst1](https://discourse.mcneel.com/u/martinborst1)\
**Post date:** [September 24, 2020, 11:34am UTC](https://discourse.mcneel.com/t/update-grasshopper-user-object-cluster-with-python-or-manually-gh-upgradeutil/109225/1 "2020-09-24T11:34:16Z")

</div>

How can I update a Grasshopper user object/ cluster (without changing the inputs / outputs at the boundaries of the cluster) while using python for example with the GH\_UpgradeUtil (Grasshopper.Kernel.GH\_UpgradeUtil)? How would a manual update process without python look like?  
Is GH\_UpgradeUtil only available for components?

I want to improve user objects over the time and then decide wether I want to update the old versions of it in documents. Is the update process

I found this:  
[Ladybug update](https://github.com/ladybug-tools/ladybug-legacy/blob/3f4f16770001633e6b3795553fa27c0eaf77fc9e/src/Ladybug_Update%20Ladybug.py#L205)  
This only seems to work for pure python code, as it seems like only the code attribute of gh python components get’s updated.

[io-generated-errors-which-component](https://www.grasshopper3d.com/forum/topics/io-generated-errors-which-component)

So you can get the version for installed components, didn’t find information about user objects yet.  
[https://www.grasshopper3d.com/forum/topics/io-generated-errors-which-component](https://www.grasshopper3d.com/forum/topics/io-generated-errors-which-component)

Information on component update process  
[[https://www.grasshopper3d.com/forum/topics/update-redraw-modified-custom-component-in-existing-defintion?page=1&commentId=2985220%3AComment%3A1836692&x=1#2985220Comment1836692](https://www.grasshopper3d.com/forum/topics/update-redraw-modified-custom-component-in-existing-defintion?page=1&commentId=2985220%3AComment%3A1836692&x=1#2985220Comment1836692)]

Information on how upgrade using _IGH\_UpgradeObject_, so one can use Solution --\>Upgrade  
([https://www.grasshopper3d.com/forum/topics/update-redraw-modified-custom-component-in-existing-defintion?page=1&commentId=2985220%3AComment%3A1836692&x=1#2985220Comment1836692](https://www.grasshopper3d.com/forum/topics/update-redraw-modified-custom-component-in-existing-defintion?page=1&commentId=2985220%3AComment%3A1836692&x=1#2985220Comment1836692))

> [@How to handle input/output definition changes when a component gets updated in a new version](https://discourse.mcneel.com/t/how-to-handle-input-output-definition-changes-when-a-component-gets-updated-in-a-new-version/64635/5):
>
> Here’s the source for the Interpolate Curve upgrader I wrote in 2012. The UpgradeFrom and UpgradeTo IDs tell Grasshopper what types of object this upgrader can work on. It has to be the ComponentGUIDs of the obsolete and new component. The Version I think is used to decide between upgraders if two happen to collide on their UpgradeFrom ID. Ultimately the Upgrade() method is called and you can do whatever you like in there. Typically you’d instantiate a new object of the correct type and try to…

---

<div class="post-metadata">

**Author:** ![andheum](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/andheum/32/743341_2.png) [@andheum](https://discourse.mcneel.com/u/andheum)\
**Post date:** [September 24, 2020, 12:20pm UTC](https://discourse.mcneel.com/t/update-grasshopper-user-object-cluster-with-python-or-manually-gh-upgradeutil/109225/2 "2020-09-24T12:20:20Z")

</div>

I don’t think you can use GH\_UpgradeUtil on user objects / clusters. It’s designed for plug-in authors to enable upgrading from one version of a component to another. It operates on the basis of the component Guid — all clusters have the same Guid so it wouldn’t know how to differentiate between them. You’ll have to write or find something custom for this purpose.

You could externalize your clusters via the “Export and Reference” menu item — this saves them out as external files. Then, make a user object from the referenced cluster. If you edit the cluster at any point and save it, it will modify your external .ghcluster file. The next time you add the cluster as a user object you’ll see this: ![Screen Shot 2020-09-24 at 8.23.47 AM](https://global.discourse-cdn.com/mcneel/uploads/default/original/3X/3/4/34601ceca04b45268ee01b3de0269ef2f3253acd.png)

You can right click it and choose “Update” to load the latest version of it from the external file. That’s one way to propagate your changes to every instance of a cluster, but it’s not totally automatic.

---

<div class="post-metadata">

**Author:** ![andheum](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/andheum/32/743341_2.png) [@andheum](https://discourse.mcneel.com/u/andheum)\
**Post date:** [September 24, 2020, 12:37pm UTC](https://discourse.mcneel.com/t/update-grasshopper-user-object-cluster-with-python-or-manually-gh-upgradeutil/109225/3 "2020-09-24T12:37:40Z")

</div>

And this might help you with the automatic update of those clusters: [Update All Clusters in a GH Script](https://discourse.mcneel.com/t/update-all-clusters-in-a-gh-script/73416/8)

---

<div class="post-metadata">

**Author:** ![martinborst1](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/martinborst1/32/607738_2.png) [@martinborst1](https://discourse.mcneel.com/u/martinborst1)\
**Post date:** [September 24, 2020, 12:50pm UTC](https://discourse.mcneel.com/t/update-grasshopper-user-object-cluster-with-python-or-manually-gh-upgradeutil/109225/4 "2020-09-24T12:50:58Z")

</div>

Thanks!

---

<div class="post-metadata">

**Author:** ![martinborst1](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/martinborst1/32/607738_2.png) [@martinborst1](https://discourse.mcneel.com/u/martinborst1)\
**Post date:** [September 29, 2020, 9:24am UTC](https://discourse.mcneel.com/t/update-grasshopper-user-object-cluster-with-python-or-manually-gh-upgradeutil/109225/5 "2020-09-29T09:24:32Z")

</div>

This seems to work for one user, but how can I dynamically edit the referenced path of the clusters?  
There are several users, which would reference different file paths for the clusters.

Can I dynamically adapt the path to the clusters from a C# or python component?  
Would a symlink leading to the different folders be enough to avoid the problem of different paths?

My use case is kinda similar to [https://www.grasshopper3d.com/forum/topics/dynamically-link-or-mass-internalize-ghcluster-references](https://www.grasshopper3d.com/forum/topics/dynamically-link-or-mass-internalize-ghcluster-references).
