So I have searched this, and there were similar questions, but their solutions don't work for me. I have cloned a code from github on google colaboratory, the import section works fine on my laptop, which imports .py files from other directories (you have to go two folders back and then enter another folder to import the py file). but on colab, it gives me the error of "no module named ex1" when importing the python file. I tried adding
sys.path.insert(0,'path to directory')
to the directory that the file is being imported from but its not working.
the main python code is at: ex1/ex2/ex3/foo.py
which imports: from ex1.ex4 import foo
so I add the following code to the main file:
sys.path.insert(0,'path to ex1')
What am I doing wrong here?