[New-bugs-announce] [issue40249] __import__ doesn't honour globals

Stefan Seefeld report at bugs.python.org
Fri Apr 10 18:33:48 EDT 2020


New submission from Stefan Seefeld <stefan at seefeld.name>:

I'm trying to import custom scripts that expect the presence of certain variables in the global namespace.
It seems `__import__('script', globals=dict(foo='bar'))` doesn't have the expected effect of injecting "foo" into the namespace and making it accessible to the script being loaded.

Is this a bug in `__import__` or am I missing something ? If the behaviour is expected, how can I achieve the desired behaviour ?

----------
components: Interpreter Core
messages: 366160
nosy: stefan
priority: normal
severity: normal
status: open
title: __import__ doesn't honour globals
type: behavior
versions: Python 3.6

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue40249>
_______________________________________


More information about the New-bugs-announce mailing list