Search code examples
pythonimportcanopy

why canopy always import a wrong python file


I have two python script named main.py and track.py. I tried to import track.py in main.py in the way below: import track ... And I tried to call a function in track.py in main.py below a=track.localization() But when I change the code of track.py, I think it make no result. And I think canopy has import other track.py where I can not find it at. If any one what's wrong, please give me an answer. By the way these two .py file are in the same folder which is my working folder. Thank you


Solution

  • I think I have had this problem before. You should be able to solve it by resetting the python kernel in between edits (there should be an option somewhere in your gui), but I don't know if this is the most efficient way to deal with this annoyance

    After googling, I think the option you want is Run menu > Restart kernel. You will need to perform this every time you change track.py, and want the changes to be reflected in main.py