# Enable/Disable Project Through Scripting

**URL:** <https://forum.inductiveautomation.com/t/enable-disable-project-through-scripting/51875>\
**Category:** Ignition\
**Tags:** ignition81\
**Created:** [October 12, 2021, 11:52pm UTC](https://forum.inductiveautomation.com/t/enable-disable-project-through-scripting/51875 "2021-10-12T23:52:08Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![williamsr.andrew](https://avatars.discourse-cdn.com/v4/letter/w/df705f/32.png) [@williamsr.andrew](https://forum.inductiveautomation.com/u/williamsr.andrew)\
**Post date:** [October 12, 2021, 11:52pm UTC](https://forum.inductiveautomation.com/t/enable-disable-project-through-scripting/51875/1 "2021-10-12T23:52:08Z")

</div>

This is more of a lesson share than a question, but I thought someone might find this helpful. I am trying to manage projects for a number of Gateways from a single “parent” Gateway. I would like all of these projects disabled at the parent so they aren’t running erroneous scripts, but I need them re-enabled when I push them to the daughter Gateways. Unfortunately, EAM respects the project enabled attribute, so I have resorted to doing this with scripting through a message handler (this would be a nice addition when pushing projects using EAM).

```python
from com.inductiveautomation.ignition.gateway import IgnitionGateway
context = IgnitionGateway.get()
projectManager = context.getProjectManager()
project = projectManager.getProject(projectName).get() # Need to get() from the java "Optional" object
resources = list(project.getAllResources().values())
manifest = project.getManifest()
	
# Need to make sure project is enabled
jsonManifest = system.util.jsonDecode(manifest.toJson(manifest))
jsonManifest['enabled'] = True
manifest = manifest.fromJson(system.util.jsonEncode(jsonManifest))

```

Now you would just need to package these up into an object and send it to the remoteGateway where you could use something like `ProjectManager.createOrReplaceProject(projectName, manifest, resources)`.

The same thing could be accomplished using the file system and editing the `project.json` file, but this seemed a bit more straightforward.

---

<div class="post-metadata">

**Author:** ![dustin.cooper](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/dustin.cooper/32/29963_2.png) [@dustin.cooper](https://forum.inductiveautomation.com/u/dustin.cooper)\
**Post date:** [January 28, 2022, 5:31pm UTC](https://forum.inductiveautomation.com/t/enable-disable-project-through-scripting/51875/2 "2022-01-28T17:31:00Z")

</div>

@williamsr.andrew Thanks for sharing this, I was working on a method to compare project details between an “alpha” and “prod” gateway, and was trying to figure out the best way to get the project manifest data. Your code snippet helped me get that working.

I was hoping that the project manifest would contain some of the “project edit” information that can be seen in the designer launcher and gateway config pages (author, last edited by, last edit time, etc). Do you know if there is any way to access this info via scripting in the gateway context? I’ve dug around in the docs for [RuntimeProject](https://files.inductiveautomation.com/sdk/javadoc/ignition81/8.1.11/com/inductiveautomation/ignition/common/project/RuntimeProject.html) object but I haven’t had any luck so far.

---

<div class="post-metadata">

**Author:** ![williamsr.andrew](https://avatars.discourse-cdn.com/v4/letter/w/df705f/32.png) [@williamsr.andrew](https://forum.inductiveautomation.com/u/williamsr.andrew)\
**Post date:** [January 30, 2022, 3:22am UTC](https://forum.inductiveautomation.com/t/enable-disable-project-through-scripting/51875/3 "2022-01-30T03:22:36Z")

</div>

Thanks @dustin.cooper! I’m glad this was able to help you!

I haven’t really looked into the project change tracking that you are talking about, but it does look like `RuntimeProject` should be able to do something like this. The `diff` function looks like it _should_ do what you want, you would just need to compare the `prod` version of the project to the updated `dev` version.

Right now I am just tracking changes manually. Each of my projects has a `version` Project Script where I keep a handful of variables like author, last modified date, and a changelog dictionary. Obviously it becomes an issue if you forget to update this, but I figure its better than nothing. You could then either import the file to access those variables, or read in the file and search for those variables.

This discussion has sparked me to look into using git for project change/version control, and it looks like there has been quite a bit of discussion around it already. If you really want to be more rigorous in change management, this would definitely be something to look into further:

> [@Best Practices for SVN/GIT on projects](https://forum.inductiveautomation.com/t/best-practices-for-svn-git-on-projects/30218):
>
> I am now experimenting with keeping my data/projects directory as a git repository, similar to described in [this thread](http://forum.inductiveautomation.com/t/svn-compatibility/28747). It’s still a bit of a bumpy process, but it definitely feels more precise (i.e. safe) than the prior methods of maintaining project history. One question I’m still trying to figure out is if there are any sub-directories or files that we should add to the .gitignore files. At the moment, I’m suspicious of the conversion-report.txt file and the .resources directory. Can any…

Here’s are a couple of resources that might be interesting for monitoring/tracking project changes:  
[https://docs.inductiveautomation.com/display/SE/Working+with+Project+Resources](https://docs.inductiveautomation.com/display/SE/Working+with+Project+Resources)

> **[Ignition 8 Deployment Best Practices](https://inductiveautomation.com/resources/article/ignition-8-deployment-best-practices)**
>
> Inductive Automation provides this helpful guide for deploying Ignition applications. The guide offers Ignition 8 best practices for setting up development and testing workflow.

---

<div class="post-metadata">

**Author:** ![jcoletti](https://avatars.discourse-cdn.com/v4/letter/j/87869e/32.png) [@jcoletti](https://forum.inductiveautomation.com/u/jcoletti)\
**Post date:** [October 8, 2024, 1:04am UTC](https://forum.inductiveautomation.com/t/enable-disable-project-through-scripting/51875/4 "2024-10-08T01:04:52Z")

</div>

I was recently looking for something similar was happy to find this thread!

I tried using `ProjectManager.createOrReplaceProject(projectName, manifest, resources)`  
but I am receiving an error when attempting to modify the manifest of the project that has a parent project. The exception is:  
`Caused by: org.python.core.PyException: java.lang.IllegalStateException: java.lang.IllegalStateException: project: MyProjectName`

Attempting to remove the parent project or have the parent project already disabled still results in the error. Has anyone encountered this or know why this is occurring? It seems to work otherwise if the project has no parent.

---

<div class="post-metadata">

**Author:** ![Darren\_Steele](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/darren_steele/32/55624_2.png) [@Darren\_Steele](https://forum.inductiveautomation.com/u/Darren_Steele)\
**Post date:** [April 2, 2026, 10:22am UTC](https://forum.inductiveautomation.com/t/enable-disable-project-through-scripting/51875/5 "2026-04-02T10:22:00Z")

</div>

I’m now encountering this on 8.3.3 - If I try to disable a project that has a parent it throws an exception - is this on anyones radar?
