-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
import the module from other directory
- Loading branch information
1 parent
a61b47d
commit 27f4f25
Showing
1 changed file
with
9 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,14 @@ | ||
import message | ||
import message.message_provider | ||
|
||
print(type(message)) | ||
print(dir(message)) | ||
print(message.message_provider.get_message()) # error! | ||
print(type(message.message_provider)) | ||
print(dir(message.message_provider)) | ||
print(message.message_provider.get_message()) | ||
|
||
# PS C:\WORK\dragondive\heavens-arena\python\modules> python main.py | ||
# 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' | ||
# ['__doc__', '__file__', '__loader__', '__name__', '__package__', '__path__', '__spec__', 'message_provider'] | ||
# <class 'module'> | ||
# ['__builtins__', '__cached__', '__doc__', '__file__', '__loader__', '__name__', '__package__', '__spec__', 'get_message'] | ||
# Hello World |