Python: return to caller module

Pagina: 1
Acties:

Onderwerpen

Vraag


Acties:
  • 0 Henk 'm!

  • Gergely
  • Registratie: Januari 2021
  • Laatst online: 12-03-2023
Mijn vraag
Don’t know how to return from a called module back to the caller module:
Situation: Python prog A.py and Python prog B.py
In prog A I can jump to prog B, using the ‘import prog B’ function in prog A. Works great.

The problem is when I want to close prog B and to return to prog A (the caller)

I tried the fowolling:
- QUIT(() , EXIT() and Sys.EXIT() kills prog B, but also prog A
- root.destroy: prog B looks to be closed and cannot be called again…

Has anyone a solution?


Relevante software en hardware die ik gebruik
Python 3.11.1
...

Wat ik al gevonden of geprobeerd heb
- QUIT(() , EXIT() and Sys.EXIT() kills prog B, but also prog A
- root.destroy: prog B looks to be closed and cannot be called again…
...

Alle reacties


Acties:
  • +2 Henk 'm!

  • remco_k
  • Registratie: April 2002
  • Laatst online: 13-05 20:28

remco_k

een cassettebandje was genoeg

Do not use all of those.
Use return instead or just let the called function run out of scope.

Alles kan stuk.