1

in Arcmap 10.2.2 I am editing downloaded toolboxes (not python-toolboxes) by editing the python script in a texteditor. Whenever I restart Arcmap, the Compiled Python File gets updated and I can use the changes I made in my tool in Arcmap.

However, the Compiled Python File does not update without restarting Arcmap (which is time-consuming), why I can not make use of the changes I made without restarting.

Is there an easy way to update / re-compile the Compiled Python File without restarting Arcmap?

2

Yes, there are several ways you can do this...If you are importing your module, you can do this:

import your_module
reload(your_module)  # will recompile .pyc

You can also use the built in py_compile module:

import py_compile
py_compile.compile(r'C:\Path_to\your_module.py')
import your_module # should be reloaded

I recommend the first option.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.