sparse-intern-71089
12/13/2021, 5:13 PMshy-musician-55524
12/13/2021, 5:14 PMbillowy-army-68599
shy-musician-55524
12/13/2021, 6:52 PMconfig
locates in the same folder as ___main___
in my case I’m trying to import package from level above
typically you can do relative import like from ..models import ModelItem
, but with pulumi it doesn’t workshy-musician-55524
12/13/2021, 6:52 PMcolossal-boots-62227
12/14/2021, 1:13 AMsys.path.append
trick:
sys.path.append(os.fsdecode(Path(__file__).resolve().parent.parent.parent))
from path.to.whatever import *
colossal-boots-62227
12/14/2021, 1:14 AM__main__
for the main Pulumi module, if you override it in config then it doesn’t work. It also only works with the from x import y
form of importcolossal-boots-62227
12/14/2021, 1:15 AMcolossal-boots-62227
12/14/2021, 1:23 AMshy-musician-55524
12/17/2021, 12:07 PM