I am fairly new to python and I do not know if what I would like to do is possible; however, I have done some searching to see if I could find an answer - I found nothing.
I have a file with classes in it. I would like to import all the classes and then run each one through a function without having to type each one out, is this possible?
IE. I want to do something like this:
instead of doing:
I have a file with classes in it. I would like to import all the classes and then run each one through a function without having to type each one out, is this possible?
IE. I want to do something like this:
Code:
from myfile import * from project.control import admin for myclass in myfile: admin.register(myclass)
Code:
from myfile import * from project.control import admin admin.register(classA) admin.register(classB) ...
Comment