Python Forum
importing variables from module - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: importing variables from module (/thread-41619.html)



importing variables from module - 8376459 - Feb-18-2024

hello experts,
i am learning python.
my question:
i am trying to import string variables from separate module to avoid retyping the same strings in each module where they are used. (i am using Pydroid app on my phone for now, to get a grip on the language). while the program seems to recognize imported variables they stay highlighted as "undefined" which is annoying. is it just Pydroid behavior or I am doing a wrong thing? TYA.


RE: importing variables from module - deanhystad - Feb-18-2024

How do you do the import?

Does the code run or do you get an error?