简体   繁体   中英

I can't use the module I created in my main python file

I created a module named module_1:

def learn(programming_lang):
  print("I am learning " + programming_lang)

and I want to use it in my main Python file.

module_1.learn("Python")   

How can I do that?

in main Python file add this line

import module_1

I added the import module_1 statement and everything went well:)

import module_1

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