Inconsistent inclusion of library code in local an cloud backtest (Python)
Consider the following file structure:
+
|- Library
| |- MyLibrary
| |- mylib.py
|- MyProject
|- main.py
In order to make mylib from MyLibrary available in main.py from MyProject I need to use two different import statements depending on whether i run the code in a local or in a cloud backtest.
Local backtest needs:
from MyLibrary import mylib
Cloud backtest needs:
import mylib
I think this difference comes from the fact that in local backtesting the Library folder is sourced into the backtest as is. However, in cloud backtesting, QC copies the contents of the referenced libraries into the projects directly. In our case here, mylib.py would be copied next to main.py.
Also suffer from this issue
Closing with #175
Now both imports work in cloud and locally:
from MyLibrary import mylib
or
import mylib
for the projects structure above.