i doing a program that modify the code of an other program and i got an error it shows me that i cant import a function
when i choose the second choice it shows me that error i have do some search and i cant find something
program 1 :
def system():
choix=input("1 ou 2")
if choix=="1":
global utilisateur
global robot
utilisateur=input("si j'ecris: ")
robot=input("il me repond: ")
fichier = open("learning.py", "a")
fichier.write("\n elif val1==utilisateur :\n print(robot)")
fichier.close()
elif choix=="2":
global admin
from learning import machine
print("console : salut")
admin=input("")
machine()
else:
print("error")
system()
program 2:
from machinelearning import utilisateur
from machinelearning import robot
from machinelearning import admin
def machine():
if admin==utilisateur :
print(robot)
elif admin==utilisateur:
print(robot)
elif val1==utilisateur:
print(robot)
error:
Traceback (most recent call last):
File “C:\Users\darewolf\Desktop\Nouveau dossier (2)\machinelearning.py”, line 19, in
system()
File “C:\Users\darewolf\Desktop\Nouveau dossier (2)\machinelearning.py”, line 13, in system
from learning import machine
File “C:\Users\darewolf\Desktop\Nouveau dossier (2)\learning.py”, line 1, in
from machinelearning import utilisateur
File “C:\Users\darewolf\Desktop\Nouveau dossier (2)\machinelearning.py”, line 19, in
system()
File “C:\Users\darewolf\Desktop\Nouveau dossier (2)\machinelearning.py”, line 13, in system
from learning import machine
ImportError: cannot import name ‘machine’ from ‘learning’ (C:\Users\darewolf\Desktop\Nouveau dossier (2)\learning.py)