I have a problem with importing modules, I using Spyder 3.7 as editor it's look like doesn't imported : First module test.py :
def func():
print('func() is tes.py')
print("top level in test.py")
if __name__=='__main__':
print('test.py is being run directly')
else:
print('test.py is being imported into another module')
Second as test2.py
import test
print ('top level in test2.py')
test.func()
if __name__=='__main__':
print('test.py is being run directly')
else:
print('test.py is being imported into another module')
Both files are registered in the same folder when I execute the test2.py I get this error
module 'test' has no attribute 'func'
I read the issue 1 and issue 2 but doesn't help me please any idea and thank you.