# Restart module in a Script or in Command Line scripts

**URL:** <https://forum.inductiveautomation.com/t/restart-module-in-a-script-or-in-command-line-scripts/50487>\
**Category:** Ignition\
**Tags:** ignition81, scripting\
**Created:** [August 31, 2021, 6:26pm UTC](https://forum.inductiveautomation.com/t/restart-module-in-a-script-or-in-command-line-scripts/50487 "2021-08-31T18:26:58Z")\
**Posts on this page:** 1\
**Showing post:** 17

<div class="post-metadata">

**Author:** ![jholloway](https://avatars.discourse-cdn.com/v4/letter/j/3ab097/32.png) [@jholloway](https://forum.inductiveautomation.com/u/jholloway)\
**Post date:** [January 31, 2024, 3:34pm UTC](https://forum.inductiveautomation.com/t/restart-module-in-a-script-or-in-command-line-scripts/50487/17 "2024-01-31T15:34:07Z")

</div>

Wanted to comment with a solution here.  
First steps are getting the module ID that needs to be reset.

```auto
#this can be removed once the ID is known
#start a logger to get to get the IDs of the installed modules, this will output to the gateway logs
logger = system.util.getLogger("myLogger")
#this will print all the 
results = system.util.getModules()
for row in range(results.rowCount):
	names = results.getValueAt(row, "Id")
	logger.info(names)

```

From this the following script can be used to reset the module. This has to be run somewhere that is gateway scoped for scripting.

```auto
#Import Java Libraries
import java.util

#Import Inductive Libraries
from com.inductiveautomation.ignition.gateway import IgnitionGateway
from com.inductiveautomation.ignition.gateway.model import ModuleManager
	
#Instantiate Gateway and Module Manager
IGW = IgnitionGateway.get()
moduleManager = IGW.getModuleManager()

#Declare the module ID as a string
moduleID = 'MODULE ID FROM LOGS HERE'
#Reset the module
moduleManager.restartModule(moduleID)

```

---

_[View the full topic](https://forum.inductiveautomation.com/t/restart-module-in-a-script-or-in-command-line-scripts/50487)._
