Siman,
I have wondered about the same thing. I have thought of two possible solutions:
1) The import process essentially takes the data in the .def file and creates new entries in the database tables, specifically the "sets" table. I think it should be possible to take a template course and create the assignments and export the "sets" and "problems" using the "wwdb" on the server to a text-based xml file. (See webwork2/bin/wwdb). Then import the relevant database entries into the corresponding tables for the desired courses. I do not know of a web-based approach to this strategy---it requires server access.
2) There are tools to script browser interactions with a webpage. For example, Selenium (http://docs.seleniumhq.org/). It would be possible to create a script that logs into the courses one at a time as an administrator, goes to the Homework Sets Editor, selects "Import", chooses the relevant problem sets, imports them, and then logs out, ready to go to the next course. (If user-lists are correct, it could also assign the problems to all users.)
If you already have server shell access, I would probably try the first method. I hadn't tried it before, but I just tried it out on a test course.
...[open shell on webwork server]
cd /opt/webwork/webwork2/bin/ (change this if needed)
./wwdb MATH205_master export ~/math205_master.xml set problem
./wwdb MATH205_1 import ~/math205_master.xml set problem
./wwdb MATH205_2 import ~/math205_master.xml set problem
(repeated for each new section)
where "MATH205_master" is the course id of my master section where the problem sets were put together, "~/math205_master.xml" is just the name of a file that I put in my home directory for the exported table information -- I just wanted something where permissions would not create problems, and "MATH205_1" and so on are the course ids of the other sections that need the same problem sets.
NOTE: This method does NOT assign the problems to the students -- I think that still needs to be done through the Instructor Tools interface.
Best wishes, and let us know if this works.
D. Brian Walton
James Madison University