简体   繁体   中英

How to import a class from a different package in the present package in python?

I have created a package in pycharm by the name "Classes in python". How can I use a class of that package in a separate package? I am using the statement "import classes in python.MyDate" and I am getting an error.

I suppose you are getting a syntax error, to import your class with name 'Point' from a module named 'xx' just type: from xx import Point

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM