Skip to content

Commit

Permalink
import only other directory
Browse files Browse the repository at this point in the history
  • Loading branch information
dragondive committed Mar 14, 2023
1 parent 51cc644 commit a61b47d
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions python/modules/main.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
import message_provider
import sys
import message

print(message_provider.get_message())
print(sys.path)
print(type(message))
print(dir(message))
print(message.message_provider.get_message()) # error!

# PS C:\WORK\dragondive\heavens-arena> python .\python\modules\main.py
# Hello World
# ['C:\\WORK\\dragondive\\heavens-arena\\python\\modules', 'C:\\WORK\\python', 'C:\\Users\\aravi\\AppData\\Local\\Programs\\Python\\Python311\\python311.zip', 'C:\\Users\\aravi\\AppData\\Local\\Programs\\Python\\Python311\\Lib', 'C:\\Users\\aravi\\AppData\\Local\\Programs\\Python\\Python311\\DLLs', 'C:\\Users\\aravi\\AppData\\Local\\Programs\\Python\\Python311', 'C:\\Users\\aravi\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages']
# PS C:\WORK\dragondive\heavens-arena\python\modules> python main.py
# <class 'module'>
# ['__doc__', '__file__', '__loader__', '__name__', '__package__', '__path__', '__spec__']
# Traceback (most recent call last):
# File "C:\WORK\dragondive\heavens-arena\python\modules\main.py", line 5, in <module>
# print(message.message_provider.get_message())
# ^^^^^^^^^^^^^^^^^^^^^^^^
# AttributeError: module 'message' has no attribute 'message_provider'

0 comments on commit a61b47d

Please sign in to comment.