Can I run specify .py file on board via REPL prompt after boot done ?

General discussions and questions abound development of code with MicroPython that is not hardware specific.
Target audience: MicroPython Users.
Post Reply
User avatar
water
Posts: 75
Joined: Sun Sep 24, 2017 9:16 am

Can I run specify .py file on board via REPL prompt after boot done ?

Post by water » Tue Mar 12, 2019 3:20 pm

Can I run specify .py file (e.g aaa.py store on Micropython board , not boot.py or main.py .) via REPL prompt after boot done?

fstengel
Posts: 55
Joined: Tue Apr 17, 2018 4:37 pm

Re: Can I run specify .py file on board via REPL prompt after boot done ?

Post by fstengel » Tue Mar 12, 2019 3:36 pm

water wrote:
Tue Mar 12, 2019 3:20 pm
Can I run specify .py file (e.g aaa.py store on Micropython board , not boot.py or main.py .) via REPL prompt after boot done?

Code: Select all

import aaa
shoud do the trick. note: no .py extension, just the file (module) name...

User avatar
water
Posts: 75
Joined: Sun Sep 24, 2017 9:16 am

Re: Can I run specify .py file on board via REPL prompt after boot done ?

Post by water » Sun Mar 17, 2019 11:40 pm

This can execute once, until reset the board.
I tried

Code: Select all

del(aaa)
and

Code: Select all

import aaa
again, not work(can't run aaa.py).
:)

User avatar
dhylands
Posts: 3821
Joined: Mon Jan 06, 2014 6:08 pm
Location: Peachland, BC, Canada
Contact:

Re: Can I run specify .py file on board via REPL prompt after boot done ?

Post by dhylands » Mon Mar 18, 2019 3:03 am

You also need to remove it from sys.modules.

See this post: viewtopic.php?f=2&t=413&p=7609

Post Reply