https://pulumi.com logo
#python
Title
# python
r

rough-oyster-77458

03/11/2022, 9:21 PM
Hi dear community, May I ask a question? I'm quite new to Pulumi, so I apologise if it might seem silly. I use
pulumi.export()
to export a variable in
file1.py
. I'm going to use this variable in
file2.py
Is there any way to get this variable in
file2.py
? So far I have found how to import this variable in CLI only
b

billowy-army-68599

03/11/2022, 9:30 PM
is file2.py in the same Pulumi project, or a new one?
r

rough-oyster-77458

03/11/2022, 10:54 PM
hi, the same one
a

adorable-computer-41765

03/14/2022, 8:16 PM
are they two different stacks?
Copy code
import pulumi

config = pulumi.Config()
stack = pulumi.get_stack()
org = config.require("org")

stack_ref = pulumi.StackReference(f"{org}/my-first-app/{stack}")

pulumi.export("shopUrl", stack_ref.get_output("url"))