Please I am pretty new to python, I am trying to import a function from a python file A to another python file B. But as soon as I import the file or just the function of the python file A, the entire imported file runs as soon as i run python file B.
# pythonfile A
def email():
print('Hello how are you doing?')
email()
user = input('Enter response')
print(user)
Running this code I get:
Hello how are you doing?
Enter your response I am good
I am good
# pythonfile B
import pythonfileA
pythonfileA.email()
Running this code I expected to get:
Hello how are you doing?
but I get
Hello how are you doing?
Enter your response I am good
I am good
instead. I also tried another alternative:
# pythonfile B
from pythonfileA import email
email()
Running that code I expected to get:
Hello how are you doing?
but I get
Hello how are you doing?
Enter your response I am good
I am good
Please help me, been searching the internet for solutions but to no good.