Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

150
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda