简体   繁体   中英

How to import python files from a folder in main program in colab

I am trying to import a script python(for example sub.py) from a folder named subfolder to main program(script python named main.ipynb) but colab can not find that module and have an error. Code for import sub.py in main program is from sub import func1,func2 branch of program is
main.ipynb
subfolder
--sub.py

from subfolder.sub import func1,func2

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM