Importing through a function
tankerguy1917

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
Coder100

hi, perhaps you are looking for the __import__ function: https://www.geeksforgeeks.org/python-__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.*