Python variable scope

I want to declare a few global Python variables in my application on startup for use by various scripts. e.g.

ip = [‘10.11.31.19’, ‘10.11.31.24’, ‘10.11.31.29’, ‘10.11.31.55’]

and to be able to access these in button press events, etc.

Q1. Is the Client Startup Script the right place for these or what is the correct ‘module level’ to place these into?
Q2. Do I need the ‘global’ syntax in declaration or use?

Many thanks.

Place that assignment in the top level of a project script. Then access it everywhere as project.myGlobals.ip.
You can also assign an empty list in the project script, and .append() items to it from anywhere else. You just cannot assign directly to that name elsewhere. Not even with global.

Thank you for your prompt reply. I wouldn’t have guessed that.

I think I’m in business until the next gap in my knowledge is exposed.