On 23/07/11 00:46, souleymane yo wrote: > my initial file name is SpO2Sweep.loops.py > In the new file I write this code to run the first one. > > [code:] > import SpO2Sweep.loops.py > SpO2Sweep.loops.py.run("com1","0","30","0.0001") > > > and It looks like the arguments are not passed to the first file. can > someone help me?
tl;dr: rename your file to a valid Python identifier, without periods, for example "loops.py". Then, you can use "import loops" (note: no .py), and loops.run(...) tl: When you say "import SpO2Sweep.loops.py", Python interpets the '.' as a separator between nested package/module names, much like your operating system interpets '/' (or perhaps '\') as a separator between directory/file names. Python thus looks for the module or package "py" within the package "loops" within the package "SpO2Sweep". For this to work, you'd need the following directory layout: ./ SpO2Sweep/ __init__.py loop/ __init__.py py.py Note: A file named __init__.py turns a plain directory into a package that Python recognises. What you actually have is this: ./ SpO2Sweep.loop.py (That won't work) Since Python treats periods specially, and names in Python cannot contain periods (the special meaning of '.' trumps), you can never import a file with that name. - Thomas -- http://mail.python.org/mailman/listinfo/python-list