The fundamental issue you are missing is that the JSL environment and the Python Environment have different variable scopes. Within JSL, names go into the global namespace when Names Default To Here(0); or not specified. They are in the 'here' namespace when Names Default To Here(1); or they are within a particular namespace if you choose to create another namespace via JSL. Further special things like :age are checked if they are column references of the current data table. This is on the JSL side of the boundary. On the Python side, variables created in Python wind up in the Python dictionary of the appropriate scope. In the globals() dictionary for the body of the script. Each module, function, ... has its own local dictionary. Python and JSL do not automatically share the variables with one another. This requires an action on your part to 'send' a JSL variable to the Python environment or 'get' a Python value back into the JSL environment. For that purpose Python Send( v ) takes the JSL value v and creates a Python variable named v with a copy of the value of v. A few special types like data tables and matrices are passed as a reference to the actual object instead of a copy. But most values come across as a copy. jV = Python Get( pV ) ; Looks up the pV variable in the Python environment and copies the value to the JSL variable jV.
As @jthi mentioned there is plenty of JMP documentation that talks about this functionality. The send() / get() capability has been fundamental with the Python Integration beginning with JMP 14. Please spend time exploring our documentation and sample scripts. The Scripting Index found from the Help menu is builtin JMP documentation for JSL and Python. Within the Scripting Index, 'All Categories' shows everything, with a search field next to it. Search of Python will quickly show all the JSL Python functionality with descriptions and runnable samples. If you chose the 'Python' category, it filters to show all the new JMP 18+ functionality supported from the Python environment. Here you will find descriptions and runnable examples showing the functionality of the JMP 18+ Python side of the integration. Lastly, from the Python environment, doc strings have been utilized so you can use Python's builtin help functionality. help( jmp.DataTable ) for example
As you have found, the flexibility of Python packages allows you create your own ways of passing data. Spending time with our documentation and samples provided. Play with them and learning how they function, will go a long way to clearing up how to best utilize JMP's Python integration.
As an aside, using Chat GPT or other AI tools to write code is only truly useful if you know how the code is supposed to work. It's just like trusting a website article, you need to know enough of how things work ( Python, JSL, ... ) to have an idea of whether the code you get is accurate, almost working, gets the concepts right, or just complete disinformation. Finally, AI knowledge of the current JMP 18+ Python integration is likely to be a lot smaller than information on JMP 14-17 simply due to the newness of JMP 18. I am confident that the best source of information is our documentation, our Scripting Index and the included $SAMPLE_SCRIPTS directories.