Closed xpol closed 11 years ago
markdown_preview = __import__("Markdown Preview.markdown", globals(), locals(), [], 0)
is what is used in the docs; __import__
being translated to from the import
statement. Maybe there is a better way of doing this , but it works. (Note: the preferred importlib
can not be imported in ST)
Edit: Looking into sublime_plugin.py
there doesn't seem to be another way to easily invoke the plugin-importing aside from __import__
.
@FichteFoll thanks.
How about
form Markdown Preview.markdown import OneClass
Translate into __import()__
.
Is it like this?
OneClass = __import__("Markdown Preview.markdown", globals(), locals(), [], 0).OneClass
No, I won't be implementing separate folder/package names since Sublime Text itself uses the folder/.sublime-package
file name as the package name. Trying to make Package Control go against the grain is not worth it.
Your choices include:
__import__
previous_names
key to the channel JSON file@xpol, almost. See http://docs.python.org/3.3/library/functions.html#__import__.
Thanks @FichteFoll & @wbond.
Some package name have spaces, which is not good for the ST3 import:
This works,
But this is not for
Markdown Preview
plugin,And we wan't keep package name unchanged and rename the package filename/floder to
MarkdownPreview
.Is there any way to do this smoothly? (User can upgrade form old filename/floder to new without knowing it has renamed).