You can not. foo-bar not an identifier. rename the file to foo_bar.py
Edit: If import not your goal (as in: you don't care what happens with sys.modules , you don't need to import it), just getting all the file globals in your own scope, you can use execfile
# contents of foo-bar.py baz = 'quux'
>>> execfile('foo-bar.py') >>> baz 'quux' >>>
SingleNegationElimination Dec 02 '11 at 2:00 a.m. 2011-12-02 02:00
source share