Jackson1442 Jackson1442 -4 years ago 125
Python Question

Open python applet, quit enclosing applet

This is really hard to put into words.

I have two applets: Applet A and Applet B. Applet A needs to be able to open Applet B based on a certain interaction, then quit itself, and vice versa.

Here's kind of what I'm looking for:

#Applet A

if [user interaction]
open Applet B
quit Applet A, but keep B open

#Applet B

if [another user interaction]
open Applet A
quit Applet B, but keep A open

(obviously this would be actual code, but trying to keep it simple here)

Thanks in advance for your help!

Answer Source

It's hard to understand fully what you mean, but you could use os.system to start the next process.

import os, sys
os.system('python appletB.py')

A better way of doing this is to not use two processes and just use two threads with a master process to control each. Then it gets a bit complicated with making sure the variables are thread-safe if you want to communicate between them.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download