# questions

Afiq Johari

02/07/2024, 3:28 PM
Hi, How can I access the current namespace when I run a node? I want to reuse a node for two different namespaces. However, one of the namespaces will require a minor data transformation. So I want to be able to define within the node by saying that if the current namespace is ABC, then perform this extra data transformation, if not, just continue. Similarly, some namespaces may skip some nodes all together. So when I perform kedro run --namespace=ABC, only relevant nodes related to the namespace should be executed
K 1

Ahdra Merali

02/07/2024, 5:47 PM
Hi Afiq, It's not possible to access the pipeline namespace form within the node. For this use case you could do the following: ā€¢ Extend your node function to accept an additional argument (e.g
transform: bool = False
), and add a condition to the function, e.g.:
Copy code
if transform: 
ā€¢ Add parameters that will hold the value for the condition, e.g.
Copy code
transform_namespace: true
ā€¢ When defining a node within your namespace pipeline, include the parameter in your inputs where you wish to trigger the condition
Copy code
    inputs=[..., "params:transform_namespace"],
šŸ‘ 1

Juan Luis

02/07/2024, 6:03 PM
on top of what @Ahdra Merali said, maybe something could be hacked with the
šŸ‘ 1