In programming, the requirement for entity names (programs, variables, etc.) to be unique is easy to understand. You cannot have two variables with the same name; if that happens, a compilation error will occur. To separate parts of the code and prevent these collisions, namespaces are used.
If we want to use a variable from another program in an ST program for reading or writing, and it is not a global variable, we must reference it using the full path. However, we must first ensure that the variable is visible outside its own "scope." This is done by marking the relevant input or output as "Publish":
The corresponding port will turn green externally, and at the same time, a new variable linear.y will be created in the namespace of its program, here main2.
If we want to use it in another program, we must call it including this namespace to distinguish it from any other variables with the same name that may exist in other namespaces.
Notice the "$" characters that enclose the variable name. They are used to clearly define the text as the variable name. The dot in linear.y does not separate the namespace, but is part of the name, as seen in the Variable Browser. An alternative notation could be:
MyVariable2 := $main2$.$linear.y$;
MyVariable1 := hw.RXIO_AI01;
uses a global variable from the hw namespace, which was automatically generated when the input-output module was created.