I
iu2
Hi,
Having a file called funcs.py, I would like to read it into a string,
and then import from that string.
That is instead of importing from the fie system, I wonder if it's
possible to eval the text in the string and treat it as a module.
For example
with file('funcs.py') as f: txt = r.read()
string_import(txt, 'funcs') # is string_import possible?
to have now a module called funcs with the functions defined in
funcs.py.
Thanks
Having a file called funcs.py, I would like to read it into a string,
and then import from that string.
That is instead of importing from the fie system, I wonder if it's
possible to eval the text in the string and treat it as a module.
For example
with file('funcs.py') as f: txt = r.read()
string_import(txt, 'funcs') # is string_import possible?
to have now a module called funcs with the functions defined in
funcs.py.
Thanks