Importing through a function

Is there a way to import classes/variables from a separate folder/file using a function? I tried it this way as well as trying to returning the a, b, and c variables, but it still didn't work.

You are viewing a single comment. View All

hi, perhaps you are looking for the __import__ function:

also don't forget about the scope. Because you imported it in a function, it can't be used outside of the function. No way around this.*