Firstly, I agree with alKid's answer. This is really more of a comment on a question than an answer, but I have no reputation for comment.
My comment:
The global name causing the error, myImport not myExample2
Explanation:
The full error message generated by my Python 2.7:
Message File Name Line Position Traceback <module> C:\xxx\example.py 7 main C:\xxx\example.py 3 NameError: global name 'myimport' is not defined
I found this question when I was trying to track down the obscure "global name undefined" error in my own code. Since the error message in the question is incorrect, I was more confused. When I actually ran the code and saw the actual error, it all made sense.
Hopefully this will not allow anyone to find this thread from the same problem as me. If someone with a greater reputation than I want to turn this into a comment or fix a question, please feel free to.
source share