I'm new in python and have not much experience in programming also.
I have this code in my main file:
def user_input():
import re
name_check = re.compile(r"[^A-Za-z\s. ]")
print("Please enter name input: ")
name = raw_input("> ")
return name
def test():
if __name__ =="__main__":
user_input()
test()
How can I get the user_input parameter in order to process it in others child modules? I'm trying to import the main module to the child file module but it doesn't work. This is my program structure:
/main
__init__.py
main.py
/child
__init__.py
child1.py
child2.py
I need to pass user_input data to child1.py. When I do importing main:
from main.main import user_input
I've got error message:
No module named main.main
Any comments would be much appreciate.
Cheers