How to shutdown from script

Hello,

I would like to shutdown a kit instance through a service call… I tried the following code:

	app = omni.kit.app.get_app()
	thread = threading.Thread(target=app.shutdown, args=())
	
	thread.start()

But that doesn’t seem to work… this call runs just endless… what am I doing wrong?

Carl

Hi @c.bickmeier. I’m app.shutdown() wants to be run in the main thread. This one worked for me:

import threading
import omni.kit.app

app = omni.kit.app.get_app()
thread = threading.Thread(target=app.post_quit, args=[0]) # arg is return code
thread.start()

Note that there is also a post_uncancellable_quit() variation too. I’m a little curious why you would want to do this if you can explain your use-case here.

Thank you very much.

We have our own “kit agent” for controlling and scheduling headless render jobs. And when we close a kit process we want to close it correctly. That´s why we need that.

Carl

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.