pythonpython-3.ximportgoogle-colaboratoryabc

ImportError: cannot import name 'my_function' from 'abc'


I'm trying to load python script from computer to google colab but is show me importError

enter image description here


Solution

  • Change the file name abc.py for something else, like testo.py and it will work.

    from google.colab import files
    
    upload = files.upload()
    
    

    check with !ls

    testo.py

    Try:

    import testo
    
    testo.myfunction()
    
    

    hello world !

    Explanation: abc is a built-in module and you should not use that name for your modules. Check this question for more info.