Hi dear community, May I ask a question? I'm quite...
# general
r
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
e
Same way you would share normal variables in Python. Just use python "import" statements.
pulumi.export
is for saving values as stack outputs so that
pulumi stack output
and StackReferences can see them.
r
Hi @echoing-dinner-19531, thanks for your answer. If I export a variable like this:
Copy code
pl.export('my_var', 'some string')
Do you mean I can import it like this:
Copy code
import my_var
Are you sure it's gonna work?
e
No if you export a variable like that you'll see it in
pulumi stack output
If you want to import a variable in another python file, just import it. There is nothing Pulumi specific about this, its just python.