0

When I import and use a function in a python(2.6.5) program, I get an error:

from Localization import MSGR

title = Localization.MSGR("Logfile from Ctf2Rrl.")

NameError: global name 'Localization' is not defined

Could you please explain why?

Regards,

2 Answers 2

4

If you import your method like this, you can user MSGR but not Localization.MSGR :)

If you want to use Localization.MSGR, you can just import Localization

Sign up to request clarification or add additional context in comments.

Comments

2

The import statement of the form:

from foo import bar

Doesn't introduce the module name (foo) from which the imports (bar) are taken into the module namespace.

Only the name bar is defined, not the module from which you imported `bar.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.