On 9/4/17 4:08 AM, Andrej Viktorovich wrote: > Hello, > > Trying to import my made module to python with helper function: > > import os.path.join > ("D","pyth_nonsens","workspace_python","PyhonTutorial","reader") > > > >>>> import os.path.join >>>> ("D","pyth_nonsens","workspace_python","PyhonTutorial","reader") > File "<stdin>", line 1 > import os.path.join > ("D","pyth_nonsens","workspace_python","PyhonTutorial","reader") > ^ > > > Can I use functions while defining paths?
As others have said, the import statement takes identifiers, not expressions. More importantly, it's unusual to try to name a specific absolute path in an import statement. The best thing is to install libraries so that you can import them like this: import reader If you can't import them, the next best thing is to use an environment variable to adjust PYTHONPATH so that the library can be found: PYTHONPATH=D:\pyth_nonsens\workspace_python\PyhonTutorial python myprog.py --Ned. -- https://mail.python.org/mailman/listinfo/python-list