dynamically create,compile and import msg files
hello,
i'm trying to create and dynamically compile msg files to use them while the node is running. Somehow it works only for the first msg file which i create,compile and import. Every file which i try to import after the first one gets an import error.
Here is a very simple example of what im trying to do:
#!/usr/bin/env python
PKG = 'janus'
msgPath = "/home/jan/Desktop/Janus/trunk/janus/msg" #my Path to the msg folder
import os
import codecs
import roslib; roslib.load_manifest(PKG)
os.chdir(msgPath)
fobj = codecs.open("test"+".msg", 'w')
fobj.write("float32 buttons")
fobj.close()
exec('os.system("rosmake %s")' %PKG)
exec('from %s.msg import test' %PKG)
fobj1 = codecs.open("test1"+".msg", 'w')
fobj1.write("float32 buttons")
fobj1.close()
exec('os.system("rosmake %s")' %PKG)
exec('from %s.msg import test1' %PKG)
So why it imports the first file, but not the second? :( hope you can help me thx