It is possible to get caller context with examining stack frame objects in python (for example via inspect module). However I can't recommend it because it is considered as a hack and also typecheck software won't work. The better way is to wrap a result explicitly from pulumi program or call different method for some more complex scenarios.