python refresh/reload

后端 未结 7 894
北海茫月
北海茫月 2020-11-27 17:58

This is a very basic question - but I haven\'t been able to find an answer by searching online.

I am using python to control ArcGIS, and I have a simple python scrip

相关标签:
7条回答
  • 2020-11-27 18:47

    If you are running in an IPython shell, then there are some magic commands that exist.

    The IPython docs cover this feature called the autoreload extension.

    Originally, I found this solution from Jonathan March's blog posting on this very subject (see point 3 from that link).

    Basically all you have to do is the following, and changes you make are reflected automatically after you save:

    In [1]: %load_ext autoreload
    
    In [2]: %autoreload 2
    
    In [3]: Import MODULE
    
    In [4]: my_class = Module.class()
            my_class.printham()
    Out[4]: ham
    
    In [5]: #make changes to printham and save
    In [6]: my_class.printham() 
    Out[6]: hamlet
    
    0 讨论(0)
提交回复
热议问题