IDAPython
plugins, loaders or processor modules developers.
Until now, IDAPython
would load all loaders, processor modules & plugins in the '__main__'
module.
This causes namespace pollution, which can sometimes leads to very obscure errors.
Starting with version 7.1
, IDA will import plugins, loaders & processor modules in their own, separate Python modules.
The names of those Python modules is derived from the plugin, loader or processor module’s file name.
E.g.,
myplg.py
will now be imported into its own '__plugins__myplg'
Python module. myldr.py
will now be imported into its own '__loaders__myldr'
Python module. myprc.py
will now be imported into its own '__procs__myprc'
Python module. It very likely means that the code in question was, in effect, relying on some other code being loaded before it, and that was “polluting” the '__main__'
module in a way that was very fortunate from its point-of-view (a happy coincidence, if you will.)
The solution is of course to fix the code in question so that it imports everything it needs, before making use of it.
However…
As a temporary workaround, you can set NAMESPACE_AWARE
to NO
in cfg/python.cfg
.
This will cause IDA to revert to the old behavior, where the '__main__'
module is shared across all plugins, loaders, processor modules & user scripts.
However, please note that support for NAMESPACE_AWARE
will be removed sometimes in the future.