Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

151
Vistas
calling multiple python functions while some of them still not finished

I'm using eel to write a program and I have an issue

let's say we have this python code:

import eel

eel.init('web')

run =1
@eel.expose
def start():
    global run 
    while run:
        print("loop")

@eel.expose
def stop():
    global run 
    run =0
    print("stopped................................")

if __name__ == '__main__':
    eel.start('index.html')

and the html and js part is like this:

<html>
  <head>
    <script type="text/javascript" src="/eel.js"></script>
    <title>doc</title>
  </head>
  <body>
    <input type="button" onclick="startJs()" value="start">
    <input type="button" onclick="stopJs()" value="stop">
    <script>
      function startJs(){
        eel.start();
      }

      function stopJs(){
        eel.stop()
      }
    </script>
  </body>
</html>

so I want to first call python start function using javascript then stop it by the stop function

but, when I hit start, the stop function(from python) doesn't work at all!!!

I think it's because, it's still processing the start function, but can I double cross it?

can anyone help please?

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Hi it's me talking to myself :_)

I've added a eel.sleep(0.001) in while loop and the stop function worked :)

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda