Several sources root, same filename inside, wrong import

Hi,

 

I have two or more sources root, which represent experiments.

Each folder has (on the same level) :

- model.py

- train.py

 

To be able to import from model.py in train.py, I have to mark the folder as sources root.

Now this was for folderA and it work great, I can use the relative imports python understands if I would launch the code from folderA.

 

I have a second folder, folderB where the structure is the same. I also mark it a sources root.

If I want to locally import from model.py into train.py now, it doesn't work anymore because it looks into the model.py from folderA, which has the same name but different content.

 

I just want to be able to use pythonic relative imports in these folders, anybody could help me?

 

Thanks !

 

Please sign in to leave a comment.