Question:
I am collaborating with someone and we are making a Pokémon game. We store the user’s data in files formatted something like this - user_PLYR.py. We’d like to import variables from the file to use for reference but I’m not sure how to access the user’s file.
Some Code
The goal is to access the user (in this case, the user’s file is ADMIN_PLYR.py) but there is no way to write from {name}_PLYR import starter
I need help making it so that I can access the user’s PLYR file.
That function provides the module as it’s return value, so if you don’t assign the value, it’s lost after that function.
Other than that, here’s some examples compared to normal imports:
import module
# or
module = __import__("module")
# --------------------------------------
from module import variable
# or
variable = __import__("module").variable
# --------------------------------------
from module import a,b
# or
a = __import__("module").a
b = __import__("module").b