In 'IDA PRO', let 'IDAPython' import default module at startup
Question: We know 'IDAPython' loads several modules by default at startup, such as
idaapi, idautils.... I wrote a module to let python print all numbers as hex
format in the command window, which I wish can be imported each time when
python loads those default modules. how to achieve that?


Answer: Create a file `%APPDATA%\Hex-Rays\IDA Pro\idapythonrc.py` with the following
content:

    
    
    import idaapi
    idaapi.require('mymodule')
    

With this file in place, you can even keep `mymodule.py` in the same
directory.

P.S. IDA can tell you the path to this directory, too, which could be handy on
other OSes or if the relevant company name changes again ;-). Just enter:

    
    
    get_user_idadir()
    

at the prompt.

