Imported module not updated
Xartrick opened this issue · 2 comments
Xartrick commented
Description
Imported modules do not reload when edited, keeping changes from being applied to main script.
How to reproduce
- Create
imported_module.py
def call_me():
return 'Foo'
- Create
main.py
from imported_module import call_me
print(call_me())
- Start IDACode from IDA
[IDACode] Listening on 127.0.0.1:7065
- Connect IDACode from VSCode
[IDACode] Client connected
[IDACode] Set workspace folder to c:\ida_code_bug
- Save
main.py
to trigger code execution
[IDACode] Executing c:\ida_code_bug\main.py
Foo
- Edit
call_me
inimported_module.py
to returnBar
def call_me():
return 'Bar'
[IDACode] Executing c:\ida_code_bug\imported_module.py
- Save
main.py
to trigger code execution
[IDACode] Executing c:\ida_code_bug\main.py
Foo
Expected result
call_me
function should returns Bar
.
Related issues
Xartrick commented
After more digging, this seems to be a known behavior, see Loading your own modules from your IDAPython scripts with idaapi.require() – Hex Rays.
Solution
from idaapi import require
require('imported_module')
from imported_module import call_me
print(call_me())
This can be closed or kept open for future reference.
ioncodes commented
Thanks for letting me know! I'll reference this issue in the README!