-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
38 lines (33 loc) · 1 KB
/
Copy pathmain.py
File metadata and controls
38 lines (33 loc) · 1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import os
def exibir_menu():
print("Menu de Seleção:")
print("1. Executar Script 1")
print("2. Executar Script 2")
print("3. Sair")
def executar_script(nome_script):
try:
# Importa o módulo do script
modulo = __import__(f'urnas.{nome_script}', fromlist=['main'])
# Chama a função main() do módulo
modulo.main()
except ImportError:
print(f"Erro: O script {nome_script} não foi encontrado.")
except AttributeError:
print(f"Erro: O script {nome_script} não possui uma função main().")
def main():
while True:
exibir_menu()
opcao = input("Escolha uma opção: ")
if opcao == "1":
executar_script("aval")
elif opcao == "2":
executar_script("godfather")
elif opcao == "3":
print("Encerrando o programa.")
break
else:
print("Opção inválida. Por favor, escolha novamente.")
if __name__ == "__main__":
main()
else :
main()