Is there any efficient debug ACT extensions way?

Options

I am writing some ACT extensions in Ansys Mechanical and I wirte some function in different python file. Then import them as modules in the main.py. But when I modified the function module file, I need closed the Mechanical and reopen it. The ACT Reload button seams only work for main.py.
So I want to know is there any efficient way to reload the modified functional module file ?

Best Answer

  • Mike.Thompson
    Mike.Thompson Member, Employee Posts: 290
    First Anniversary First Comment 5 Likes Ansys Employee
    Answer ✓
    Options

    You are correct in the behavior of the reload button. To reload imported modules, use this standard iron python code.

    import SomeModule
    reload(SomeModule)

    The reload function will reread the imported file and code behavior will be updated. When I am actively working on a project, I almost always reload after import to reflect changes being made on the fly. Once the project is done, I simply remove these lines.