Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Imported module not updated #36

Closed
Xartrick opened this issue Dec 27, 2022 · 2 comments
Closed

Imported module not updated #36

Xartrick opened this issue Dec 27, 2022 · 2 comments

Comments

@Xartrick
Copy link

Xartrick commented Dec 27, 2022

Description

Imported modules do not reload when edited, keeping changes from being applied to main script.

How to reproduce

  1. Create imported_module.py
def call_me():
    return 'Foo'
  1. Create main.py
from imported_module import call_me

print(call_me())
  1. Start IDACode from IDA
[IDACode] Listening on 127.0.0.1:7065
  1. Connect IDACode from VSCode
[IDACode] Client connected
[IDACode] Set workspace folder to c:\ida_code_bug
  1. Save main.py to trigger code execution
[IDACode] Executing c:\ida_code_bug\main.py
Foo
  1. Edit call_me in imported_module.py to return Bar
def call_me():
    return 'Bar'
[IDACode] Executing c:\ida_code_bug\imported_module.py
  1. 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
Copy link
Author

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
Copy link
Owner

Thanks for letting me know! I'll reference this issue in the README!

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants