Follow below steps for importing .py file in REPL (PowerShell, CMD).
if you create empty file with name __ init __.py Python will consider it as module. Its very existence tells Python to treat the directory as a package.
Python checks in the directories in sequential order starting at the first directory in sys.path list, till it find the .py file it was looking for.
sys.path Documentation
- import sys
- sys.path.insert(1, 'C:/Users/Atif/PycharmProjects/Import_Txt_URL')
- import MODULE_NAME as alias
if you create empty file with name __ init __.py Python will consider it as module. Its very existence tells Python to treat the directory as a package.
Python checks in the directories in sequential order starting at the first directory in sys.path list, till it find the .py file it was looking for.
sys.path Documentation
Comments
Post a Comment